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