428
|
1 /* Define X specific console, device, and frame object for XEmacs.
|
|
2 Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
|
1318
|
4 Copyright (C) 1996, 2002, 2003 Ben Wing.
|
428
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
8 XEmacs is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by the
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: Not in FSF. */
|
|
24
|
|
25
|
|
26 /* Authorship:
|
|
27
|
|
28 Ultimately based on FSF, then later on JWZ work for Lemacs.
|
|
29 Rewritten over time by Ben Wing and Chuck Thompson (original
|
|
30 multi-device work by Chuck Thompson).
|
|
31 */
|
|
32
|
440
|
33 #ifndef INCLUDED_console_x_h_
|
|
34 #define INCLUDED_console_x_h_
|
428
|
35
|
|
36 #ifdef HAVE_X_WINDOWS
|
|
37
|
|
38 #include "console.h"
|
2484
|
39 /* must come before Xutil.h, which is included indirectly from xintrinsic.h,
|
|
40 to avoid breakage in keysym-parsing macros from X11R6, at least X.org as
|
|
41 of 2005-01-17, and probably XFree86 too from reports on c.e.x */
|
|
42 #include <X11/keysym.h>
|
428
|
43 #include "xintrinsic.h"
|
1346
|
44 #include "../lwlib/lwlib.h"
|
428
|
45
|
|
46 #include <X11/cursorfont.h>
|
|
47 #include <X11/Xatom.h>
|
|
48 #include <X11/StringDefs.h>
|
|
49
|
|
50 #ifdef HAVE_XPM
|
|
51 #include <X11/xpm.h>
|
|
52 #endif
|
|
53
|
3094
|
54 #ifdef USE_XFT
|
|
55 /* shut up GCC */
|
|
56 #define face_index face_index_arg
|
|
57 #define glyph_index glyph_index_arg
|
|
58 #include <X11/Xft/Xft.h>
|
|
59 #undef glyph_index
|
|
60 #undef face_index
|
|
61 /* #### this should be made gone */
|
|
62 #ifndef XFT_VERSION
|
|
63 #define XFT_VERSION 1
|
|
64 #endif
|
|
65 #endif
|
|
66
|
428
|
67 /* R5 defines the XPointer type, but R4 doesn't.
|
|
68 R4 also doesn't define a version number, but R5 does. */
|
|
69 #if (XlibSpecificationRelease < 5)
|
|
70 # define XPointer char *
|
|
71 #endif
|
|
72
|
|
73 #define Xt_SET_VALUE(widget, resource, value) do { \
|
|
74 Arg al; \
|
|
75 XtSetArg (al, resource, value); \
|
|
76 XtSetValues (widget, &al, 1); \
|
|
77 } while (0)
|
|
78
|
|
79 #define Xt_GET_VALUE(widget, resource, location) do { \
|
|
80 Arg al; \
|
|
81 XtSetArg (al, resource, location); \
|
|
82 XtGetValues (widget, &al, 1); \
|
|
83 } while (0)
|
|
84
|
1204
|
85 #ifdef __cplusplus
|
|
86 #define X_CLASSFIELD c_class
|
|
87 #else
|
|
88 #define X_CLASSFIELD class
|
|
89 #endif
|
|
90
|
428
|
91 /* Variables associated with the X display frame this emacs is using. */
|
|
92 extern XtAppContext Xt_app_con;
|
|
93
|
|
94 extern Lisp_Object Vx_gc_pointer_shape;
|
|
95 extern Lisp_Object Vx_scrollbar_pointer_shape;
|
|
96 extern Lisp_Object Qx_error;
|
|
97
|
|
98 /* Number of pixels below each line. */
|
|
99 extern int x_interline_space; /* #### implement me */
|
|
100
|
458
|
101 extern Fixnum x_selection_timeout;
|
428
|
102
|
|
103 struct frame *x_any_window_to_frame (struct device *d, Window);
|
|
104 struct frame *x_any_widget_or_parent_to_frame (struct device *d,
|
|
105 Widget widget);
|
|
106 struct frame *decode_x_frame (Lisp_Object);
|
|
107 struct frame *x_window_to_frame (struct device *d, Window);
|
|
108 struct device *get_device_from_display (Display *dpy);
|
|
109 struct device *decode_x_device (Lisp_Object);
|
|
110
|
|
111 void x_handle_selection_notify (XSelectionEvent *event);
|
|
112 void x_handle_selection_request (XSelectionRequestEvent *event);
|
|
113 void x_handle_selection_clear (XSelectionClearEvent *event);
|
|
114 void x_handle_property_notify (XPropertyEvent *event);
|
|
115
|
440
|
116 void Xatoms_of_select_x (struct device *d);
|
428
|
117 void Xatoms_of_objects_x (struct device *d);
|
|
118
|
|
119 void x_wm_set_shell_iconic_p (Widget shell, int iconic_p);
|
|
120 void x_wm_set_cell_size (Widget wmshell, int cw, int ch);
|
|
121 void x_wm_set_variable_size (Widget wmshell, int width, int height);
|
|
122
|
442
|
123 const char *x_event_name (int event_type);
|
1204
|
124 int check_if_pending_expose_event (struct device *d);
|
428
|
125 int x_error_handler (Display *disp, XErrorEvent *event);
|
|
126 void expect_x_error (Display *dpy);
|
|
127 int x_error_occurred_p (Display *dpy);
|
|
128 int signal_if_x_error (Display *dpy, int resumable_p);
|
|
129 int x_IO_error_handler (Display *disp);
|
|
130
|
1346
|
131 widget_value *xmalloc_widget_value (void);
|
|
132
|
|
133 LWLIB_ID new_lwlib_id (void);
|
|
134
|
|
135 void gcpro_popup_callbacks (LWLIB_ID id);
|
|
136 void ungcpro_popup_callbacks (LWLIB_ID id);
|
|
137 int popup_handled_p (LWLIB_ID id);
|
|
138 void free_popup_widget_value_tree (widget_value *wv);
|
|
139 void popup_selection_callback (Widget widget, LWLIB_ID ignored_id,
|
|
140 XtPointer client_data);
|
|
141 Extbyte *add_accel_and_to_external (Lisp_Object string);
|
|
142 int button_item_to_widget_value (Lisp_Object gui_object_instance,
|
|
143 Lisp_Object gui_item, widget_value *wv,
|
|
144 int allow_text_field_p, int no_keys_p,
|
|
145 int menu_entry_p, int accel_p);
|
|
146 widget_value * gui_items_to_widget_values (Lisp_Object gui_object_instance,
|
|
147 Lisp_Object items, int accel_p);
|
|
148 Extbyte *menu_separator_style_and_to_external (const Ibyte *s);
|
|
149 Lisp_Object widget_value_unwind (Lisp_Object closure);
|
|
150
|
428
|
151 void x_output_string (struct window *w, struct display_line *dl,
|
867
|
152 Ichar_dynarr *buf, int xpos, int xoffset,
|
428
|
153 int start_pixpos, int width, face_index findex,
|
|
154 int cursor, int cursor_start, int cursor_width,
|
|
155 int cursor_height);
|
440
|
156 void x_output_x_pixmap (struct frame *f, Lisp_Image_Instance *p,
|
428
|
157 int x, int y, int xoffset, int yoffset,
|
|
158 int width, int height,
|
|
159 unsigned long fg, unsigned long bg,
|
|
160 GC override_gc);
|
|
161 void x_output_shadows (struct frame *f, int x, int y, int width,
|
|
162 int height, GC top_shadow_gc,
|
|
163 GC bottom_shadow_gc, GC background_gc,
|
|
164 int shadow_thickness, int edges);
|
|
165 void x_generate_shadow_pixels (struct frame *f,
|
|
166 unsigned long *top_shadow,
|
|
167 unsigned long *bottom_shadow,
|
|
168 unsigned long background,
|
|
169 unsigned long core_background);
|
|
170
|
|
171 int x_initialize_frame_menubar (struct frame *f);
|
|
172 void x_init_modifier_mapping (struct device *d);
|
|
173
|
593
|
174 int x_frame_window_state (struct frame *f);
|
|
175
|
428
|
176 #define X_ERROR_OCCURRED(dpy, body) \
|
|
177 (expect_x_error (dpy), body, x_error_occurred_p (dpy))
|
|
178
|
|
179 #define HANDLING_X_ERROR(dpy, body) \
|
|
180 (expect_x_error (dpy), body, signal_if_x_error (dpy, 0))
|
|
181
|
|
182 void Initialize_Locale (void);
|
|
183
|
|
184 #ifdef HAVE_XIM
|
|
185
|
|
186 /* X Input Method `methods' */
|
|
187 void XIM_init_device (struct device *d);
|
|
188 void XIM_init_frame (struct frame *f);
|
|
189 void XIM_SetSpotLocation (struct frame *f, int x, int y);
|
|
190 void XIM_SetGeometry (struct frame *f);
|
|
191 void XIM_focus_event (struct frame *f, int in_p);
|
|
192
|
|
193 #ifdef XIM_XLIB
|
|
194 /* XtTypeConverter */
|
|
195 Boolean EmacsXtCvtStringToXIMStyles (
|
|
196 Display *dpy,
|
|
197 XrmValuePtr args,
|
|
198 Cardinal *num_args,
|
|
199 XrmValuePtr from,
|
|
200 XrmValuePtr to_in_out,
|
|
201 XtPointer *converter_data);
|
|
202
|
|
203 /* XtDestructor */
|
|
204 void EmacsFreeXIMStyles (
|
|
205 XtAppContext app,
|
|
206 XrmValuePtr to,
|
|
207 XtPointer converter_data,
|
|
208 XrmValuePtr args,
|
|
209 Cardinal *num_args);
|
|
210
|
|
211 #ifdef DEBUG_XEMACS
|
|
212 void describe_Window (Window win);
|
|
213 void describe_XFontSet (XFontSet font_set);
|
|
214 void describe_XIM (XIM im);
|
|
215 void describe_XIMStyle (XIMStyle style);
|
|
216 void describe_XIMStyles (XIMStyles *styles);
|
|
217 void describe_XIC (XIC ic);
|
|
218 void describe_event_mask (unsigned long mask);
|
|
219 void describe_XRectangle (char *name, XRectangle *rect);
|
|
220 void describe_Status (Status status);
|
|
221 #endif /* DEBUG_XEMACS */
|
|
222 #endif /* XIM_XLIB */
|
|
223 #endif /* HAVE_XIM */
|
|
224
|
771
|
225 extern Lisp_Object Qxintl;
|
|
226
|
428
|
227 extern int in_resource_setting;
|
|
228 extern int in_specifier_change_function;
|
|
229
|
|
230 extern Lisp_Object Vx_initial_argv_list; /* #### ugh! */
|
|
231
|
|
232 #endif /* HAVE_X_WINDOWS */
|
440
|
233
|
|
234 #endif /* INCLUDED_console_x_h_ */
|