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.
5 This file is part of XEmacs.
7 XEmacs is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with XEmacs; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* Synched up with: Not in FSF. */
27 Ultimately based on FSF, then later on JWZ work for Lemacs.
28 Rewritten over time by Ben Wing and Chuck Thompson (original
29 multi-device work by Chuck Thompson).
32 #ifndef _XEMACS_CONSOLE_GTK_H_
33 #define _XEMACS_CONSOLE_GTK_H_
40 #define GDK_DRAWABLE(x) (GdkDrawable *) (x)
41 #define GET_GTK_WIDGET_WINDOW(x) (GTK_WIDGET (x)->window)
42 #define GET_GTK_WIDGET_PARENT(x) (GTK_WIDGET (x)->parent)
44 DECLARE_CONSOLE_TYPE (gtk);
48 /* Gtk application info. */
49 GtkWidget *gtk_app_shell;
51 /* Cache of GC's for frame's on this device. */
52 struct gc_cache *gc_cache;
54 /* Selected visual, depth and colormap for this device */
57 GdkColormap *device_cmap;
59 /* Used by x_bevel_modeline in redisplay-x.c */
60 GdkBitmap *gray_pixmap;
62 /* frame that holds the WM_COMMAND property; there should be exactly
63 one of these per device. */
64 Lisp_Object WM_COMMAND_frame;
66 /* The following items are all used exclusively in event-gtk.c. */
67 int MetaMask, HyperMask, SuperMask, AltMask, ModeMask;
68 guint lock_interpretation;
70 void *x_modifier_keymap; /* Really an (XModifierKeymap *)*/
73 int x_keysym_map_min_code;
74 int x_keysym_map_max_code;
75 int x_keysym_map_keysyms_per_code;
76 Lisp_Object x_keysym_map_hashtable;
78 /* #### It's not clear that there is much distinction anymore
79 between mouse_timestamp and global_mouse_timestamp, now that
80 Emacs doesn't see most (all?) events not destined for it. */
82 /* The timestamp of the last button or key event used by emacs itself.
83 This is used for asserting selections and input focus. */
84 guint32 mouse_timestamp;
86 /* This is the timestamp the last button or key event whether it was
87 dispatched to emacs or widgets. */
88 guint32 global_mouse_timestamp;
90 /* This is the last known timestamp received from the server. It is
91 maintained by x_event_to_emacs_event and used to patch bogus
92 WM_TAKE_FOCUS messages sent by Mwm. */
93 guint32 last_server_timestamp;
95 GdkAtom atom_WM_PROTOCOLS;
96 GdkAtom atom_WM_TAKE_FOCUS;
97 GdkAtom atom_WM_STATE;
101 /* stuff for sticky modifiers: */
102 unsigned int need_to_add_mask, down_mask;
103 KeyCode last_downkey;
104 guint32 release_time;
108 #define DEVICE_GTK_DATA(d) DEVICE_TYPE_DATA (d, gtk)
110 #define DEVICE_GTK_VISUAL(d) (DEVICE_GTK_DATA (d)->visual)
111 #define DEVICE_GTK_DEPTH(d) (DEVICE_GTK_DATA (d)->depth)
112 #define DEVICE_GTK_COLORMAP(d) (DEVICE_GTK_DATA (d)->device_cmap)
113 #define DEVICE_GTK_APP_SHELL(d) (DEVICE_GTK_DATA (d)->gtk_app_shell)
114 #define DEVICE_GTK_GC_CACHE(d) (DEVICE_GTK_DATA (d)->gc_cache)
115 #define DEVICE_GTK_GRAY_PIXMAP(d) (DEVICE_GTK_DATA (d)->gray_pixmap)
116 #define DEVICE_GTK_WM_COMMAND_FRAME(d) (DEVICE_GTK_DATA (d)->WM_COMMAND_frame)
117 #define DEVICE_GTK_MOUSE_TIMESTAMP(d) (DEVICE_GTK_DATA (d)->mouse_timestamp)
118 #define DEVICE_GTK_GLOBAL_MOUSE_TIMESTAMP(d) (DEVICE_GTK_DATA (d)->global_mouse_timestamp)
119 #define DEVICE_GTK_LAST_SERVER_TIMESTAMP(d) (DEVICE_GTK_DATA (d)->last_server_timestamp)
121 /* The maximum number of widgets that can be displayed above the text
122 area at one time. Currently no more than 3 will ever actually be
123 displayed (menubar, psheet, debugger panel). */
124 #define MAX_CONCURRENT_TOP_WIDGETS 8
128 /* The widget of this frame. */
129 GtkWidget *widget; /* This is really a GtkWindow */
131 /* The layout manager */
132 GtkWidget *container; /* actually a GtkVBox. */
134 /* The widget of the menubar */
135 GtkWidget *menubar_widget;
137 /* The widget of the edit portion of this frame; this is a GtkDrawingArea,
138 and the window of this widget is what the redisplay code draws on. */
139 GtkWidget *edit_widget;
141 /* Lists the widgets above the text area, in the proper order. */
142 GtkWidget *top_widgets[MAX_CONCURRENT_TOP_WIDGETS];
145 /* Our container widget as a Lisp_Object */
146 Lisp_Object lisp_visible_widgets[10];
148 /*************************** Miscellaneous **************************/
150 /* The icon pixmaps; these are Lisp_Image_Instance objects, or Qnil. */
151 Lisp_Object icon_pixmap;
152 Lisp_Object icon_pixmap_mask;
154 /* geometry string that ought to be freed. */
155 char *geom_free_me_please;
157 /* 1 if the frame is completely visible on the display, 0 otherwise.
158 if 0 the frame may have been iconified or may be totally
159 or partially hidden by another X window */
160 unsigned int totally_visible_p :1;
162 /* Is it visible at all? */
163 unsigned int visible_p :1;
165 /* Are we a top-level frame? This means that our shell is a
166 TopLevelShell, and we should do certain things to interact with
167 the window manager. */
168 unsigned int top_level_frame_p :1;
170 /* Are we iconfied right now? */
171 unsigned int iconified_p :1;
175 #define FRAME_GTK_DATA(f) FRAME_TYPE_DATA (f, gtk)
177 #define FRAME_GTK_SHELL_WIDGET(f) (FRAME_GTK_DATA (f)->widget)
178 #define FRAME_GTK_CONTAINER_WIDGET(f) (FRAME_GTK_DATA (f)->container)
179 #define FRAME_GTK_MENUBAR_WIDGET(f) (FRAME_GTK_DATA (f)->menubar_widget)
180 #define FRAME_GTK_TEXT_WIDGET(f) (FRAME_GTK_DATA (f)->edit_widget)
181 #define FRAME_GTK_TOP_WIDGETS(f) (FRAME_GTK_DATA (f)->top_widgets)
182 #define FRAME_GTK_NUM_TOP_WIDGETS(f) (FRAME_GTK_DATA (f)->num_top_widgets)
183 #define FRAME_GTK_ICONIFIED_P(f) (FRAME_GTK_DATA (f)->iconfigied_p)
185 #define FRAME_GTK_LISP_WIDGETS(f) (FRAME_GTK_DATA (f)->lisp_visible_widgets)
186 #define FRAME_GTK_ICON_PIXMAP(f) (FRAME_GTK_DATA (f)->icon_pixmap)
187 #define FRAME_GTK_ICON_PIXMAP_MASK(f) (FRAME_GTK_DATA (f)->icon_pixmap_mask)
189 #define FRAME_GTK_GEOM_FREE_ME_PLEASE(f) (FRAME_GTK_DATA (f)->geom_free_me_please)
191 #define FRAME_GTK_TOTALLY_VISIBLE_P(f) (FRAME_GTK_DATA (f)->totally_visible_p)
192 #define FRAME_GTK_VISIBLE_P(f) (FRAME_GTK_DATA (f)->visible_p)
193 #define FRAME_GTK_TOP_LEVEL_FRAME_P(f) (FRAME_GTK_DATA (f)->top_level_frame_p)
195 /* Variables associated with the X display frame this emacs is using. */
197 extern Lisp_Object Vx_gc_pointer_shape;
198 extern Lisp_Object Vx_scrollbar_pointer_shape;
200 extern struct console_type *gtk_console_type;
201 extern Lisp_Object Vdefault_gtk_device;
203 /* Number of pixels below each line. */
204 extern int gtk_interline_space;
206 extern int gtk_selection_timeout;
208 struct frame *gtk_any_window_to_frame (struct device *d, GdkWindow *);
209 struct frame *gtk_window_to_frame (struct device *d, GdkWindow *);
210 struct frame *gtk_any_widget_or_parent_to_frame (struct device *d, GtkWidget *widget);
211 struct frame *decode_gtk_frame (Lisp_Object);
212 struct device *gtk_any_window_to_device (GdkWindow *);
213 struct device *decode_gtk_device (Lisp_Object);
214 void gtk_handle_property_notify (GdkEventProperty *event);
216 void signal_special_gtk_user_event (Lisp_Object channel, Lisp_Object function,
218 void gtk_redraw_exposed_area (struct frame *f, int x, int y,
219 int width, int height);
220 void gtk_output_string (struct window *w, struct display_line *dl,
221 Emchar_dynarr *buf, int xpos, int xoffset,
222 int start_pixpos, int width, face_index findex,
223 int cursor, int cursor_start, int cursor_width,
225 void gtk_output_gdk_pixmap (struct frame *f, struct Lisp_Image_Instance *p,
226 int x, int y, int clip_x, int clip_y,
227 int clip_width, int clip_height, int width,
228 int height, int pixmap_offset,
229 GdkColor *fg, GdkColor *bg,
231 void gtk_output_shadows (struct frame *f, int x, int y, int width,
232 int height, int shadow_thickness);
234 int gtk_initialize_frame_menubar (struct frame *f);
235 void gtk_init_modifier_mapping (struct device *d);
237 void Initialize_Locale (void);
239 extern Lisp_Object Vgtk_initial_argv_list; /* #### ugh! */
241 const char *gtk_event_name (GdkEventType event_type);
242 #endif /* HAVE_GTK */
243 #endif /* _XEMACS_DEVICE_X_H_ */