Allow 'browse-url-emacs' to fetch URL in the selected window
[emacs.git] / src / xterm.h
blob1849a5c95351e8cfdc8d8bc2099ebfb9a1a7bd00
1 /* Definitions and headers for communication with X protocol.
2 Copyright (C) 1989, 1993-1994, 1998-2018 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 extern Window tip_window;
508 /* Each X frame object points to its own struct x_output object
509 in the output_data.x field. The x_output structure contains
510 the information that is specific to X windows. */
512 struct x_output
514 #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
515 /* Height of menu bar widget, in pixels. This value
516 is not meaningful if the menubar is turned off. */
517 int menubar_height;
518 #endif
520 /* Height of tool bar widget, in pixels. top_height is used if tool bar
521 at top, bottom_height if tool bar is at the bottom.
522 Zero if not using an external tool bar or if tool bar is vertical. */
523 int toolbar_top_height, toolbar_bottom_height;
525 /* Width of tool bar widget, in pixels. left_width is used if tool bar
526 at left, right_width if tool bar is at the right.
527 Zero if not using an external tool bar or if tool bar is horizontal. */
528 int toolbar_left_width, toolbar_right_width;
530 /* The tiled border used when the mouse is out of the frame. */
531 Pixmap border_tile;
533 /* Here are the Graphics Contexts for the default font. */
534 GC normal_gc; /* Normal video */
535 GC reverse_gc; /* Reverse video */
536 GC cursor_gc; /* cursor drawing */
538 /* The X window used for this frame.
539 May be zero while the frame object is being created
540 and the X window has not yet been created. */
541 Window window_desc;
543 /* The drawable to which we're rendering. In the single-buffered
544 base, the window itself. In the double-buffered case, the
545 window's back buffer. */
546 Drawable draw_desc;
548 /* Flag that indicates whether we've modified the back buffer and
549 need to publish our modifications to the front buffer at a
550 convenient time. */
551 bool need_buffer_flip;
553 /* The X window used for the bitmap icon;
554 or 0 if we don't have a bitmap icon. */
555 Window icon_desc;
557 /* The X window that is the parent of this X window.
558 Usually this is a window that was made by the window manager,
559 but it can be the root window, and it can be explicitly specified
560 (see the explicit_parent field, below). */
561 Window parent_desc;
563 #ifdef USE_X_TOOLKIT
564 /* The widget of this screen. This is the window of a "shell" widget. */
565 Widget widget;
566 /* The XmPanedWindows... */
567 Widget column_widget;
568 /* The widget of the edit portion of this screen; the window in
569 "window_desc" is inside of this. */
570 Widget edit_widget;
572 Widget menubar_widget;
573 #endif
575 #ifdef USE_GTK
576 /* The widget of this screen. This is the window of a top widget. */
577 GtkWidget *widget;
578 /* The widget of the edit portion of this screen; the window in
579 "window_desc" is inside of this. */
580 GtkWidget *edit_widget;
581 /* The widget used for laying out widgets vertically. */
582 GtkWidget *vbox_widget;
583 /* The widget used for laying out widgets horizontally. */
584 GtkWidget *hbox_widget;
585 /* The menubar in this frame. */
586 GtkWidget *menubar_widget;
587 /* The tool bar in this frame */
588 GtkWidget *toolbar_widget;
589 /* True if tool bar is packed into the hbox widget (i.e. vertical). */
590 bool_bf toolbar_in_hbox : 1;
591 bool_bf toolbar_is_packed : 1;
593 /* The last size hints set. */
594 GdkGeometry size_hints;
595 long hint_flags;
597 #ifdef USE_GTK_TOOLTIP
598 GtkTooltip *ttip_widget;
599 GtkWidget *ttip_lbl;
600 GtkWindow *ttip_window;
601 #endif /* USE_GTK_TOOLTIP */
603 #endif /* USE_GTK */
605 /* If >=0, a bitmap index. The indicated bitmap is used for the
606 icon. */
607 ptrdiff_t icon_bitmap;
609 /* Default ASCII font of this frame. */
610 struct font *font;
612 /* The baseline offset of the default ASCII font. */
613 int baseline_offset;
615 /* If a fontset is specified for this frame instead of font, this
616 value contains an ID of the fontset, else -1. */
617 int fontset;
619 unsigned long cursor_pixel;
620 unsigned long border_pixel;
621 unsigned long mouse_pixel;
622 unsigned long cursor_foreground_pixel;
624 /* Foreground color for scroll bars. A value of -1 means use the
625 default (black for non-toolkit scroll bars). */
626 unsigned long scroll_bar_foreground_pixel;
628 /* Background color for scroll bars. A value of -1 means use the
629 default (background color of the frame for non-toolkit scroll
630 bars). */
631 unsigned long scroll_bar_background_pixel;
633 #if defined (USE_LUCID) && defined (USE_TOOLKIT_SCROLL_BARS)
634 /* Top and bottom shadow colors for 3D Lucid scrollbars.
635 -1 means let the scroll compute them itself. */
636 unsigned long scroll_bar_top_shadow_pixel;
637 unsigned long scroll_bar_bottom_shadow_pixel;
638 #endif
640 /* Descriptor for the cursor in use for this window. */
641 Cursor text_cursor;
642 Cursor nontext_cursor;
643 Cursor modeline_cursor;
644 Cursor hand_cursor;
645 Cursor hourglass_cursor;
646 Cursor horizontal_drag_cursor;
647 Cursor vertical_drag_cursor;
648 Cursor current_cursor;
649 Cursor left_edge_cursor;
650 Cursor top_left_corner_cursor;
651 Cursor top_edge_cursor;
652 Cursor top_right_corner_cursor;
653 Cursor right_edge_cursor;
654 Cursor bottom_right_corner_cursor;
655 Cursor bottom_edge_cursor;
656 Cursor bottom_left_corner_cursor;
658 /* Window whose cursor is hourglass_cursor. This window is temporarily
659 mapped to display an hourglass cursor. */
660 Window hourglass_window;
662 /* These are the current window manager hints. It seems that
663 XSetWMHints, when presented with an unset bit in the `flags'
664 member of the hints structure, does not leave the corresponding
665 attribute unchanged; rather, it resets that attribute to its
666 default value. For example, unless you set the `icon_pixmap'
667 field and the `IconPixmapHint' bit, XSetWMHints will forget what
668 your icon pixmap was. This is rather troublesome, since some of
669 the members (for example, `input' and `icon_pixmap') want to stay
670 the same throughout the execution of Emacs. So, we keep this
671 structure around, just leaving values in it and adding new bits
672 to the mask as we go. */
673 XWMHints wm_hints;
675 /* This is the Emacs structure for the X display this frame is on. */
676 struct x_display_info *display_info;
678 /* This is a button event that wants to activate the menubar.
679 We save it here until the command loop gets to think about it. */
680 XEvent *saved_menu_event;
682 /* This is the widget id used for this frame's menubar in lwlib. */
683 #ifdef USE_X_TOOLKIT
684 int id;
685 #endif
687 /* True means hourglass cursor is currently displayed. */
688 bool_bf hourglass_p : 1;
690 /* True means our parent is another application's window
691 and was explicitly specified. */
692 bool_bf explicit_parent : 1;
694 /* True means tried already to make this frame visible. */
695 bool_bf asked_for_visible : 1;
697 /* True if this frame was ever previously visible. */
698 bool_bf has_been_visible : 1;
700 /* Xt waits for a ConfigureNotify event from the window manager in
701 EmacsFrameSetCharSize when the shell widget is resized. For some
702 window managers like fvwm2 2.2.5 and KDE 2.1 this event doesn't
703 arrive for an unknown reason and Emacs hangs in Xt. If this is
704 false, tell Xt not to wait. */
705 bool_bf wait_for_wm : 1;
707 #ifdef HAVE_X_I18N
708 /* Input context (currently, this means Compose key handler setup). */
709 XIC xic;
710 XIMStyle xic_style;
711 XFontSet xic_xfs;
712 #endif
714 /* Relief GCs, colors etc. */
715 struct relief
717 GC gc;
718 unsigned long pixel;
720 black_relief, white_relief;
722 /* The background for which the above relief GCs were set up.
723 They are changed only when a different background is involved. */
724 unsigned long relief_background;
726 /* Keep track of focus. May be EXPLICIT if we received a FocusIn for this
727 frame, or IMPLICIT if we received an EnterNotify.
728 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
729 int focus_state;
731 /* The offset we need to add to compensate for type A WMs. */
732 int move_offset_top;
733 int move_offset_left;
735 /* Extreme 'short' and 'long' values suitable for libX11. */
736 #define X_SHRT_MAX 0x7fff
737 #define X_SHRT_MIN (-1 - X_SHRT_MAX)
738 #define X_LONG_MAX 0x7fffffff
739 #define X_LONG_MIN (-1 - X_LONG_MAX)
740 #define X_ULONG_MAX 0xffffffffUL
742 #ifdef USE_CAIRO
743 /* Cairo drawing context. */
744 cairo_t *cr_context;
745 /* Cairo surface for double buffering */
746 cairo_surface_t *cr_surface;
747 #endif
750 #define No_Cursor (None)
752 enum
754 /* Values for focus_state, used as bit mask.
755 EXPLICIT means we received a FocusIn for the frame and know it has
756 the focus. IMPLICIT means we received an EnterNotify and the frame
757 may have the focus if no window manager is running.
758 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
759 FOCUS_NONE = 0,
760 FOCUS_IMPLICIT = 1,
761 FOCUS_EXPLICIT = 2
765 /* Return the X output data for frame F. */
766 #define FRAME_X_OUTPUT(f) ((f)->output_data.x)
768 /* Return the X window used for displaying data in frame F. */
769 #define FRAME_X_WINDOW(f) ((f)->output_data.x->window_desc)
771 /* Return the drawable used for rendering to frame F. */
772 #define FRAME_X_RAW_DRAWABLE(f) ((f)->output_data.x->draw_desc)
774 extern void x_mark_frame_dirty (struct frame *f);
776 /* Return the drawable used for rendering to frame F and mark the
777 frame as needing a buffer flip later. There's no easy way to run
778 code after any drawing command, but we can run code whenever
779 someone asks for the handle necessary to draw. */
780 #define FRAME_X_DRAWABLE(f) \
781 (x_mark_frame_dirty((f)), FRAME_X_RAW_DRAWABLE ((f)))
783 #define FRAME_X_DOUBLE_BUFFERED_P(f) \
784 (FRAME_X_WINDOW (f) != FRAME_X_RAW_DRAWABLE (f))
786 /* Return the need-buffer-flip flag for frame F. */
787 #define FRAME_X_NEED_BUFFER_FLIP(f) ((f)->output_data.x->need_buffer_flip)
789 /* Return the outermost X window associated with the frame F. */
790 #ifdef USE_X_TOOLKIT
791 #define FRAME_OUTER_WINDOW(f) ((f)->output_data.x->widget ? \
792 XtWindow ((f)->output_data.x->widget) : \
793 FRAME_X_WINDOW (f))
794 #else
795 #ifdef USE_GTK
796 /* Functions not present in older Gtk+ */
798 #ifndef HAVE_GTK_WIDGET_GET_WINDOW
799 #define gtk_widget_get_window(w) ((w)->window)
800 #endif
801 #ifndef HAVE_GTK_WIDGET_GET_MAPPED
802 #define gtk_widget_get_mapped(w) (GTK_WIDGET_MAPPED (w))
803 #endif
804 #ifndef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE
805 #define gtk_adjustment_get_page_size(w) ((w)->page_size)
806 #define gtk_adjustment_get_upper(w) ((w)->upper)
807 #endif
809 #ifdef HAVE_GTK3
810 #define DEFAULT_GDK_DISPLAY() \
811 gdk_x11_display_get_xdisplay (gdk_display_get_default ())
812 #else
813 #undef GDK_WINDOW_XID
814 #define GDK_WINDOW_XID(w) GDK_WINDOW_XWINDOW (w)
815 #define DEFAULT_GDK_DISPLAY() GDK_DISPLAY ()
816 #define gtk_widget_get_preferred_size(a, ign, b) \
817 gtk_widget_size_request (a, b)
818 #endif
820 #define GTK_WIDGET_TO_X_WIN(w) \
821 ((w) && gtk_widget_get_window (w) \
822 ? GDK_WINDOW_XID (gtk_widget_get_window (w)) : 0)
824 #define FRAME_GTK_OUTER_WIDGET(f) ((f)->output_data.x->widget)
825 #define FRAME_GTK_WIDGET(f) ((f)->output_data.x->edit_widget)
826 #define FRAME_OUTER_WINDOW(f) \
827 (FRAME_GTK_OUTER_WIDGET (f) ? \
828 GTK_WIDGET_TO_X_WIN (FRAME_GTK_OUTER_WIDGET (f)) : \
829 FRAME_X_WINDOW (f))
831 #else /* !USE_GTK */
832 #define FRAME_OUTER_WINDOW(f) (FRAME_X_WINDOW (f))
833 #endif /* !USE_GTK */
834 #endif
836 #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
837 #define FRAME_MENUBAR_HEIGHT(f) ((f)->output_data.x->menubar_height)
838 #else
839 #define FRAME_MENUBAR_HEIGHT(f) ((void) f, 0)
840 #endif /* USE_X_TOOLKIT || USE_GTK */
842 #define FRAME_FONT(f) ((f)->output_data.x->font)
843 #define FRAME_FONTSET(f) ((f)->output_data.x->fontset)
844 #define FRAME_TOOLBAR_TOP_HEIGHT(f) ((f)->output_data.x->toolbar_top_height)
845 #define FRAME_TOOLBAR_BOTTOM_HEIGHT(f) \
846 ((f)->output_data.x->toolbar_bottom_height)
847 #define FRAME_TOOLBAR_HEIGHT(f) \
848 (FRAME_TOOLBAR_TOP_HEIGHT (f) + FRAME_TOOLBAR_BOTTOM_HEIGHT (f))
849 #define FRAME_TOOLBAR_LEFT_WIDTH(f) ((f)->output_data.x->toolbar_left_width)
850 #define FRAME_TOOLBAR_RIGHT_WIDTH(f) ((f)->output_data.x->toolbar_right_width)
851 #define FRAME_TOOLBAR_WIDTH(f) \
852 (FRAME_TOOLBAR_LEFT_WIDTH (f) + FRAME_TOOLBAR_RIGHT_WIDTH (f))
853 #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.x->baseline_offset)
855 /* This gives the x_display_info structure for the display F is on. */
856 #define FRAME_DISPLAY_INFO(f) ((f)->output_data.x->display_info)
858 /* This is the `Display *' which frame F is on. */
859 #define FRAME_X_DISPLAY(f) (FRAME_DISPLAY_INFO (f)->display)
861 /* This is the `Screen *' which frame F is on. */
862 #define FRAME_X_SCREEN(f) (FRAME_DISPLAY_INFO (f)->screen)
864 /* This is the screen index number of screen which frame F is on. */
865 #define FRAME_X_SCREEN_NUMBER(f) XScreenNumberOfScreen (FRAME_X_SCREEN (f))
867 /* This is the Visual which frame F is on. */
868 #define FRAME_X_VISUAL(f) FRAME_DISPLAY_INFO (f)->visual
870 /* This is the Colormap which frame F uses. */
871 #define FRAME_X_COLORMAP(f) FRAME_DISPLAY_INFO (f)->cmap
873 #define FRAME_XIC(f) ((f)->output_data.x->xic)
874 #define FRAME_X_XIM(f) (FRAME_DISPLAY_INFO (f)->xim)
875 #define FRAME_X_XIM_STYLES(f) (FRAME_DISPLAY_INFO (f)->xim_styles)
876 #define FRAME_XIC_STYLE(f) ((f)->output_data.x->xic_style)
877 #define FRAME_XIC_FONTSET(f) ((f)->output_data.x->xic_xfs)
879 /* X-specific scroll bar stuff. */
881 /* We represent scroll bars as lisp vectors. This allows us to place
882 references to them in windows without worrying about whether we'll
883 end up with windows referring to dead scroll bars; the garbage
884 collector will free it when its time comes.
886 We use struct scroll_bar as a template for accessing fields of the
887 vector. */
889 struct scroll_bar
891 /* These fields are shared by all vectors. */
892 union vectorlike_header header;
894 /* The window we're a scroll bar for. */
895 Lisp_Object window;
897 /* The next and previous in the chain of scroll bars in this frame. */
898 Lisp_Object next, prev;
900 /* Fields from `x_window' down will not be traced by the GC. */
902 /* The X window representing this scroll bar. */
903 Window x_window;
905 /* The position and size of the scroll bar in pixels, relative to the
906 frame. */
907 int top, left, width, height;
909 /* The starting and ending positions of the handle, relative to the
910 handle area (i.e. zero is the top position, not
911 SCROLL_BAR_TOP_BORDER). If they're equal, that means the handle
912 hasn't been drawn yet.
914 These are not actually the locations where the beginning and end
915 are drawn; in order to keep handles from becoming invisible when
916 editing large files, we establish a minimum height by always
917 drawing handle bottoms VERTICAL_SCROLL_BAR_MIN_HANDLE pixels below
918 where they would be normally; the bottom and top are in a
919 different co-ordinate system. */
920 int start, end;
922 /* If the scroll bar handle is currently being dragged by the user,
923 this is the number of pixels from the top of the handle to the
924 place where the user grabbed it. If the handle isn't currently
925 being dragged, this is -1. */
926 int dragging;
928 #if defined (USE_TOOLKIT_SCROLL_BARS) && defined (USE_LUCID)
929 /* Last scroll bar part seen in xaw_jump_callback and xaw_scroll_callback. */
930 enum scroll_bar_part last_seen_part;
931 #endif
933 #if defined (USE_TOOLKIT_SCROLL_BARS) && !defined (USE_GTK)
934 /* Last value of whole for horizontal scrollbars. */
935 int whole;
936 #endif
938 /* True if the scroll bar is horizontal. */
939 bool horizontal;
942 /* Turning a lisp vector value into a pointer to a struct scroll_bar. */
943 #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))
945 #ifdef USE_X_TOOLKIT
947 /* Extract the X widget of the scroll bar from a struct scroll_bar.
948 XtWindowToWidget should be fast enough since Xt uses a hash table
949 to map windows to widgets. */
951 #define SCROLL_BAR_X_WIDGET(dpy, ptr) \
952 XtWindowToWidget (dpy, ptr->x_window)
954 /* Store a widget id in a struct scroll_bar. */
956 #define SET_SCROLL_BAR_X_WIDGET(ptr, w) \
957 do { \
958 Window window = XtWindow (w); \
959 ptr->x_window = window; \
960 } while (false)
962 #endif /* USE_X_TOOLKIT */
964 /* Return the inside width of a vertical scroll bar, given the outside
965 width. */
966 #define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(f, width) \
967 ((width) \
968 - VERTICAL_SCROLL_BAR_LEFT_BORDER \
969 - VERTICAL_SCROLL_BAR_RIGHT_BORDER)
971 /* Return the length of the rectangle within which the top of the
972 handle must stay. This isn't equivalent to the inside height,
973 because the scroll bar handle has a minimum height.
975 This is the real range of motion for the scroll bar, so when we're
976 scaling buffer positions to scroll bar positions, we use this, not
977 VERTICAL_SCROLL_BAR_INSIDE_HEIGHT. */
978 #define VERTICAL_SCROLL_BAR_TOP_RANGE(f, height) \
979 (VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, height) - VERTICAL_SCROLL_BAR_MIN_HANDLE)
981 /* Return the inside height of vertical scroll bar, given the outside
982 height. See VERTICAL_SCROLL_BAR_TOP_RANGE too. */
983 #define VERTICAL_SCROLL_BAR_INSIDE_HEIGHT(f, height) \
984 ((height) - VERTICAL_SCROLL_BAR_TOP_BORDER - VERTICAL_SCROLL_BAR_BOTTOM_BORDER)
986 /* Return the inside height of a horizontal scroll bar, given the outside
987 height. */
988 #define HORIZONTAL_SCROLL_BAR_INSIDE_HEIGHT(f, height) \
989 ((height) \
990 - HORIZONTAL_SCROLL_BAR_TOP_BORDER \
991 - HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER)
993 /* Return the length of the rectangle within which the left part of the
994 handle must stay. This isn't equivalent to the inside width, because
995 the scroll bar handle has a minimum width.
997 This is the real range of motion for the scroll bar, so when we're
998 scaling buffer positions to scroll bar positions, we use this, not
999 HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH. */
1000 #define HORIZONTAL_SCROLL_BAR_LEFT_RANGE(f, width) \
1001 (HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH (f, width) - HORIZONTAL_SCROLL_BAR_MIN_HANDLE)
1003 /* Return the inside width of horizontal scroll bar, given the outside
1004 width. See HORIZONTAL_SCROLL_BAR_LEFT_RANGE too. */
1005 #define HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH(f, width) \
1006 ((width) - HORIZONTAL_SCROLL_BAR_LEFT_BORDER - HORIZONTAL_SCROLL_BAR_LEFT_BORDER)
1009 /* Border widths for scroll bars.
1011 Scroll bar windows don't have any X borders; their border width is
1012 set to zero, and we redraw borders ourselves. This makes the code
1013 a bit cleaner, since we don't have to convert between outside width
1014 (used when relating to the rest of the screen) and inside width
1015 (used when sizing and drawing the scroll bar window itself).
1017 The handle moves up and down/back and forth in a rectangle inset
1018 from the edges of the scroll bar. These are widths by which we
1019 inset the handle boundaries from the scroll bar edges. */
1020 #define VERTICAL_SCROLL_BAR_LEFT_BORDER (2)
1021 #define VERTICAL_SCROLL_BAR_RIGHT_BORDER (2)
1022 #define VERTICAL_SCROLL_BAR_TOP_BORDER (2)
1023 #define VERTICAL_SCROLL_BAR_BOTTOM_BORDER (2)
1025 #define HORIZONTAL_SCROLL_BAR_LEFT_BORDER (2)
1026 #define HORIZONTAL_SCROLL_BAR_RIGHT_BORDER (2)
1027 #define HORIZONTAL_SCROLL_BAR_TOP_BORDER (2)
1028 #define HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER (2)
1030 /* Minimum lengths for scroll bar handles, in pixels. */
1031 #define VERTICAL_SCROLL_BAR_MIN_HANDLE (5)
1032 #define HORIZONTAL_SCROLL_BAR_MIN_HANDLE (5)
1034 /* If a struct input_event has a kind which is SELECTION_REQUEST_EVENT
1035 or SELECTION_CLEAR_EVENT, then its contents are really described
1036 by this structure. */
1038 /* For an event of kind SELECTION_REQUEST_EVENT,
1039 this structure really describes the contents. */
1041 struct selection_input_event
1043 ENUM_BF (event_kind) kind : EVENT_KIND_WIDTH;
1044 struct x_display_info *dpyinfo;
1045 /* We spell it with an "o" here because X does. */
1046 Window requestor;
1047 Atom selection, target, property;
1048 Time time;
1051 /* Unlike macros below, this can't be used as an lvalue. */
1052 INLINE Display *
1053 SELECTION_EVENT_DISPLAY (struct selection_input_event *ev)
1055 return ev->dpyinfo->display;
1057 #define SELECTION_EVENT_DPYINFO(eventp) \
1058 ((eventp)->dpyinfo)
1059 /* We spell it with an "o" here because X does. */
1060 #define SELECTION_EVENT_REQUESTOR(eventp) \
1061 ((eventp)->requestor)
1062 #define SELECTION_EVENT_SELECTION(eventp) \
1063 ((eventp)->selection)
1064 #define SELECTION_EVENT_TARGET(eventp) \
1065 ((eventp)->target)
1066 #define SELECTION_EVENT_PROPERTY(eventp) \
1067 ((eventp)->property)
1068 #define SELECTION_EVENT_TIME(eventp) \
1069 ((eventp)->time)
1071 /* From xfns.c. */
1073 extern void x_free_gcs (struct frame *);
1074 extern void x_relative_mouse_position (struct frame *, int *, int *);
1075 extern void x_real_pos_and_offsets (struct frame *f,
1076 int *left_offset_x,
1077 int *right_offset_x,
1078 int *top_offset_y,
1079 int *bottom_offset_y,
1080 int *x_pixels_diff,
1081 int *y_pixels_diff,
1082 int *xptr,
1083 int *yptr,
1084 int *outer_border);
1086 /* From xrdb.c. */
1088 XrmDatabase x_load_resources (Display *, const char *, const char *,
1089 const char *);
1091 /* Defined in xterm.c */
1093 typedef void (*x_special_error_handler)(Display *, XErrorEvent *, char *,
1094 void *);
1096 extern bool x_text_icon (struct frame *, const char *);
1097 extern void x_catch_errors (Display *);
1098 extern void x_catch_errors_with_handler (Display *, x_special_error_handler,
1099 void *);
1100 extern void x_check_errors (Display *, const char *)
1101 ATTRIBUTE_FORMAT_PRINTF (2, 0);
1102 extern bool x_had_errors_p (Display *);
1103 extern void x_uncatch_errors (void);
1104 extern void x_uncatch_errors_after_check (void);
1105 extern void x_clear_errors (Display *);
1106 extern void xembed_request_focus (struct frame *);
1107 extern void x_ewmh_activate_frame (struct frame *);
1108 extern void x_delete_terminal (struct terminal *terminal);
1109 extern unsigned long x_copy_color (struct frame *, unsigned long);
1110 #ifdef USE_X_TOOLKIT
1111 extern XtAppContext Xt_app_con;
1112 extern void x_activate_timeout_atimer (void);
1113 #endif
1114 #ifdef USE_LUCID
1115 extern bool x_alloc_lighter_color_for_widget (Widget, Display *, Colormap,
1116 unsigned long *,
1117 double, int);
1118 #endif
1119 extern bool x_alloc_nearest_color (struct frame *, Colormap, XColor *);
1120 extern void x_query_color (struct frame *f, XColor *);
1121 extern void x_clear_area (struct frame *f, int, int, int, int);
1122 #if !defined USE_X_TOOLKIT && !defined USE_GTK
1123 extern void x_mouse_leave (struct x_display_info *);
1124 #endif
1126 #if defined USE_X_TOOLKIT || defined USE_MOTIF
1127 extern int x_dispatch_event (XEvent *, Display *);
1128 #endif
1129 extern int x_x_to_emacs_modifiers (struct x_display_info *, int);
1130 #ifdef USE_CAIRO
1131 extern cairo_t *x_begin_cr_clip (struct frame *, GC);
1132 extern void x_end_cr_clip (struct frame *);
1133 extern void x_set_cr_source_with_gc_foreground (struct frame *, GC);
1134 extern void x_set_cr_source_with_gc_background (struct frame *, GC);
1135 extern void x_cr_draw_frame (cairo_t *, struct frame *);
1136 extern Lisp_Object x_cr_export_frames (Lisp_Object, cairo_surface_type_t);
1137 #endif
1139 INLINE int
1140 x_display_pixel_height (struct x_display_info *dpyinfo)
1142 return HeightOfScreen (dpyinfo->screen);
1145 INLINE int
1146 x_display_pixel_width (struct x_display_info *dpyinfo)
1148 return WidthOfScreen (dpyinfo->screen);
1151 INLINE void
1152 x_display_set_last_user_time (struct x_display_info *dpyinfo, Time t)
1154 #ifdef ENABLE_CHECKING
1155 eassert (t <= X_ULONG_MAX);
1156 #endif
1157 dpyinfo->last_user_time = t;
1160 INLINE unsigned long
1161 x_make_truecolor_pixel (struct x_display_info *dpyinfo, int r, int g, int b)
1163 unsigned long pr, pg, pb;
1165 /* Scale down RGB values to the visual's bits per RGB, and shift
1166 them to the right position in the pixel color. Note that the
1167 original RGB values are 16-bit values, as usual in X. */
1168 pr = (r >> (16 - dpyinfo->red_bits)) << dpyinfo->red_offset;
1169 pg = (g >> (16 - dpyinfo->green_bits)) << dpyinfo->green_offset;
1170 pb = (b >> (16 - dpyinfo->blue_bits)) << dpyinfo->blue_offset;
1172 /* Assemble the pixel color. */
1173 return pr | pg | pb;
1176 /* If display has an immutable color map, freeing colors is not
1177 necessary and some servers don't allow it, so we won't do it. That
1178 also allows us to make other optimizations relating to server-side
1179 reference counts. */
1180 INLINE bool
1181 x_mutable_colormap (Visual *visual)
1183 int class = visual->class;
1184 return (class != StaticColor && class != StaticGray && class != TrueColor);
1187 extern void x_set_sticky (struct frame *, Lisp_Object, Lisp_Object);
1188 extern void x_set_skip_taskbar (struct frame *, Lisp_Object, Lisp_Object);
1189 extern void x_set_z_group (struct frame *, Lisp_Object, Lisp_Object);
1190 extern bool x_wm_supports (struct frame *, Atom);
1191 extern void x_wait_for_event (struct frame *, int);
1192 extern void x_clear_under_internal_border (struct frame *f);
1194 extern void tear_down_x_back_buffer (struct frame *f);
1195 extern void initial_set_up_x_back_buffer (struct frame *f);
1197 /* Defined in xselect.c. */
1199 extern void x_handle_property_notify (const XPropertyEvent *);
1200 extern void x_handle_selection_notify (const XSelectionEvent *);
1201 extern void x_handle_selection_event (struct selection_input_event *);
1202 extern void x_clear_frame_selections (struct frame *);
1204 extern void x_send_client_event (Lisp_Object display,
1205 Lisp_Object dest,
1206 Lisp_Object from,
1207 Atom message_type,
1208 Lisp_Object format,
1209 Lisp_Object values);
1211 extern bool x_handle_dnd_message (struct frame *,
1212 const XClientMessageEvent *,
1213 struct x_display_info *,
1214 struct input_event *);
1215 extern int x_check_property_data (Lisp_Object);
1216 extern void x_fill_property_data (Display *,
1217 Lisp_Object,
1218 void *,
1219 int);
1220 extern Lisp_Object x_property_data_to_lisp (struct frame *,
1221 const unsigned char *,
1222 Atom,
1223 int,
1224 unsigned long);
1225 extern void x_clipboard_manager_save_frame (Lisp_Object);
1226 extern void x_clipboard_manager_save_all (void);
1228 #ifdef USE_GTK
1229 extern bool xg_set_icon (struct frame *, Lisp_Object);
1230 extern bool xg_set_icon_from_xpm_data (struct frame *, const char **);
1231 #endif /* USE_GTK */
1233 extern void xic_free_xfontset (struct frame *);
1234 extern void create_frame_xic (struct frame *);
1235 extern void destroy_frame_xic (struct frame *);
1236 extern void xic_set_preeditarea (struct window *, int, int);
1237 extern void xic_set_statusarea (struct frame *);
1238 extern void xic_set_xfontset (struct frame *, const char *);
1239 extern bool x_defined_color (struct frame *, const char *, XColor *, bool);
1240 #ifdef HAVE_X_I18N
1241 extern void free_frame_xic (struct frame *);
1242 # if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT
1243 extern char *xic_create_fontsetname (const char *, bool);
1244 # endif
1245 #endif
1247 /* Defined in xfaces.c */
1249 #ifdef USE_X_TOOLKIT
1250 extern void x_free_dpy_colors (Display *, Screen *, Colormap,
1251 unsigned long *, int);
1252 #endif /* USE_X_TOOLKIT */
1254 /* Defined in xmenu.c */
1256 #if defined USE_X_TOOLKIT || defined USE_GTK
1257 extern Lisp_Object xw_popup_dialog (struct frame *, Lisp_Object, Lisp_Object);
1258 #endif
1260 #if defined USE_GTK || defined USE_MOTIF
1261 extern void x_menu_set_in_use (bool);
1262 #endif
1263 extern void x_menu_wait_for_event (void *data);
1264 extern void initialize_frame_menubar (struct frame *);
1266 /* Defined in xsmfns.c */
1267 #ifdef HAVE_X_SM
1268 extern void x_session_initialize (struct x_display_info *dpyinfo);
1269 extern bool x_session_have_connection (void);
1270 extern void x_session_close (void);
1271 #endif
1274 /* Is the frame embedded into another application? */
1276 #define FRAME_X_EMBEDDED_P(f) (FRAME_X_OUTPUT(f)->explicit_parent != 0)
1278 #define STORE_XCHAR2B(chp, b1, b2) \
1279 ((chp)->byte1 = (b1), (chp)->byte2 = (b2))
1281 #define XCHAR2B_BYTE1(chp) \
1282 ((chp)->byte1)
1284 #define XCHAR2B_BYTE2(chp) \
1285 ((chp)->byte2)
1287 #define STORE_NATIVE_RECT(nr,rx,ry,rwidth,rheight) \
1288 ((nr).x = (rx), \
1289 (nr).y = (ry), \
1290 (nr).width = (rwidth), \
1291 (nr).height = (rheight))
1293 INLINE_HEADER_END
1295 #endif /* XTERM_H */