2168
|
1 /* Define GTK specific console, device, and frame object for XEmacs.
|
872
|
2 Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
|
|
4 Copyright (C) 2002 Ben Wing.
|
|
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).
|
2168
|
31 Gtk version by William M. Perry
|
|
32
|
872
|
33 */
|
|
34
|
|
35 #ifndef INCLUDED_console_gtk_impl_h_
|
|
36 #define INCLUDED_console_gtk_impl_h_
|
|
37
|
|
38 #ifdef HAVE_GTK
|
|
39
|
|
40 #include "console-impl.h"
|
|
41 #include "console-gtk.h"
|
2054
|
42 #include <X11/Xlib.h>
|
872
|
43
|
|
44 #define GDK_DRAWABLE(x) (GdkDrawable *) (x)
|
|
45 #define GET_GTK_WIDGET_WINDOW(x) (GTK_WIDGET (x)->window)
|
|
46 #define GET_GTK_WIDGET_PARENT(x) (GTK_WIDGET (x)->parent)
|
|
47
|
|
48 DECLARE_CONSOLE_TYPE (gtk);
|
|
49
|
|
50 struct gtk_device
|
|
51 {
|
|
52 /* Gtk application info. */
|
|
53 GtkWidget *gtk_app_shell;
|
|
54
|
|
55 /* Cache of GC's for frame's on this device. */
|
|
56 struct gc_cache *gc_cache;
|
|
57
|
|
58 /* Selected visual, depth and colormap for this device */
|
|
59 GdkVisual *visual;
|
|
60 int depth;
|
|
61 GdkColormap *device_cmap;
|
|
62
|
|
63 /* Used by x_bevel_modeline in redisplay-x.c */
|
|
64 GdkBitmap *gray_pixmap;
|
|
65
|
|
66 /* frame that holds the WM_COMMAND property; there should be exactly
|
|
67 one of these per device. */
|
|
68 Lisp_Object WM_COMMAND_frame;
|
|
69
|
|
70 /* The following items are all used exclusively in event-gtk.c. */
|
|
71 int MetaMask, HyperMask, SuperMask, AltMask, ModeMask;
|
2054
|
72 KeySym lock_interpretation;
|
872
|
73
|
2054
|
74 XModifierKeymap *x_modifier_keymap;
|
872
|
75
|
2054
|
76 KeySym *x_keysym_map;
|
872
|
77 int x_keysym_map_min_code;
|
|
78 int x_keysym_map_max_code;
|
|
79 int x_keysym_map_keysyms_per_code;
|
|
80 Lisp_Object x_keysym_map_hashtable;
|
|
81
|
|
82 /* #### It's not clear that there is much distinction anymore
|
|
83 between mouse_timestamp and global_mouse_timestamp, now that
|
|
84 Emacs doesn't see most (all?) events not destined for it. */
|
|
85
|
|
86 /* The timestamp of the last button or key event used by emacs itself.
|
|
87 This is used for asserting selections and input focus. */
|
|
88 guint32 mouse_timestamp;
|
|
89
|
|
90 /* This is the timestamp the last button or key event whether it was
|
|
91 dispatched to emacs or widgets. */
|
|
92 guint32 global_mouse_timestamp;
|
|
93
|
|
94 /* This is the last known timestamp received from the server. It is
|
|
95 maintained by x_event_to_emacs_event and used to patch bogus
|
|
96 WM_TAKE_FOCUS messages sent by Mwm. */
|
|
97 guint32 last_server_timestamp;
|
|
98
|
|
99 GdkAtom atom_WM_PROTOCOLS;
|
|
100 GdkAtom atom_WM_TAKE_FOCUS;
|
|
101 GdkAtom atom_WM_STATE;
|
|
102
|
|
103 #if 0
|
|
104 /* #### BILL!!! */
|
|
105 /* stuff for sticky modifiers: */
|
|
106 unsigned int need_to_add_mask, down_mask;
|
|
107 KeyCode last_downkey;
|
|
108 guint32 release_time;
|
|
109 #endif
|
|
110 };
|
|
111
|
|
112 #define DEVICE_GTK_DATA(d) DEVICE_TYPE_DATA (d, gtk)
|
|
113
|
|
114 #define DEVICE_GTK_VISUAL(d) (DEVICE_GTK_DATA (d)->visual)
|
|
115 #define DEVICE_GTK_DEPTH(d) (DEVICE_GTK_DATA (d)->depth)
|
|
116 #define DEVICE_GTK_COLORMAP(d) (DEVICE_GTK_DATA (d)->device_cmap)
|
|
117 #define DEVICE_GTK_APP_SHELL(d) (DEVICE_GTK_DATA (d)->gtk_app_shell)
|
|
118 #define DEVICE_GTK_GC_CACHE(d) (DEVICE_GTK_DATA (d)->gc_cache)
|
|
119 #define DEVICE_GTK_GRAY_PIXMAP(d) (DEVICE_GTK_DATA (d)->gray_pixmap)
|
|
120 #define DEVICE_GTK_WM_COMMAND_FRAME(d) (DEVICE_GTK_DATA (d)->WM_COMMAND_frame)
|
|
121 #define DEVICE_GTK_MOUSE_TIMESTAMP(d) (DEVICE_GTK_DATA (d)->mouse_timestamp)
|
|
122 #define DEVICE_GTK_GLOBAL_MOUSE_TIMESTAMP(d) (DEVICE_GTK_DATA (d)->global_mouse_timestamp)
|
|
123 #define DEVICE_GTK_LAST_SERVER_TIMESTAMP(d) (DEVICE_GTK_DATA (d)->last_server_timestamp)
|
|
124
|
|
125 /* The maximum number of widgets that can be displayed above the text
|
|
126 area at one time. Currently no more than 3 will ever actually be
|
|
127 displayed (menubar, psheet, debugger panel). */
|
|
128 #define MAX_CONCURRENT_TOP_WIDGETS 8
|
|
129
|
|
130 struct gtk_frame
|
|
131 {
|
|
132 /* The widget of this frame. */
|
|
133 GtkWidget *widget; /* This is really a GtkWindow */
|
|
134
|
|
135 /* The layout manager */
|
|
136 GtkWidget *container; /* actually a GtkVBox. */
|
|
137
|
|
138 /* The widget of the menubar */
|
|
139 GtkWidget *menubar_widget;
|
|
140
|
|
141 /* The widget of the edit portion of this frame; this is a GtkDrawingArea,
|
|
142 and the window of this widget is what the redisplay code draws on. */
|
|
143 GtkWidget *edit_widget;
|
|
144
|
|
145 /* Lists the widgets above the text area, in the proper order. */
|
|
146 GtkWidget *top_widgets[MAX_CONCURRENT_TOP_WIDGETS];
|
|
147 int num_top_widgets;
|
|
148
|
|
149 /* Our container widget as a Lisp_Object */
|
1204
|
150 Lisp_Object lisp_visible_widgets[3];
|
872
|
151
|
1346
|
152 Lisp_Object menubar_data;
|
872
|
153
|
|
154 /* The icon pixmaps; these are Lisp_Image_Instance objects, or Qnil. */
|
|
155 Lisp_Object icon_pixmap;
|
|
156 Lisp_Object icon_pixmap_mask;
|
|
157
|
|
158 /* geometry string that ought to be freed. */
|
|
159 char *geom_free_me_please;
|
|
160
|
|
161 /* 1 if the frame is completely visible on the display, 0 otherwise.
|
|
162 if 0 the frame may have been iconified or may be totally
|
|
163 or partially hidden by another X window */
|
|
164 unsigned int totally_visible_p :1;
|
|
165
|
|
166 /* Is it visible at all? */
|
|
167 unsigned int visible_p :1;
|
|
168
|
|
169 /* Are we a top-level frame? This means that our shell is a
|
|
170 TopLevelShell, and we should do certain things to interact with
|
|
171 the window manager. */
|
|
172 unsigned int top_level_frame_p :1;
|
|
173
|
|
174 /* Are we iconfied right now? */
|
|
175 unsigned int iconified_p :1;
|
|
176
|
2168
|
177 /* Data for widget callbacks. It is impossible to pass all the necessary
|
|
178 data through the GTK signal API so instead it is registered here and the
|
|
179 hash key is passed instead. */
|
|
180 Lisp_Object widget_instance_hash_table;
|
|
181 Lisp_Object widget_callback_hash_table;
|
|
182 Lisp_Object widget_callback_ex_hash_table;
|
872
|
183 };
|
|
184
|
|
185 #define FRAME_GTK_DATA(f) FRAME_TYPE_DATA (f, gtk)
|
|
186
|
|
187 #define FRAME_GTK_SHELL_WIDGET(f) (FRAME_GTK_DATA (f)->widget)
|
|
188 #define FRAME_GTK_CONTAINER_WIDGET(f) (FRAME_GTK_DATA (f)->container)
|
|
189 #define FRAME_GTK_MENUBAR_WIDGET(f) (FRAME_GTK_DATA (f)->menubar_widget)
|
|
190 #define FRAME_GTK_TEXT_WIDGET(f) (FRAME_GTK_DATA (f)->edit_widget)
|
|
191 #define FRAME_GTK_TOP_WIDGETS(f) (FRAME_GTK_DATA (f)->top_widgets)
|
|
192 #define FRAME_GTK_NUM_TOP_WIDGETS(f) (FRAME_GTK_DATA (f)->num_top_widgets)
|
|
193 #define FRAME_GTK_ICONIFIED_P(f) (FRAME_GTK_DATA (f)->iconfigied_p)
|
|
194
|
1346
|
195 #define FRAME_GTK_MENUBAR_DATA(f) (FRAME_GTK_DATA (f)->menubar_data)
|
|
196
|
872
|
197 #define FRAME_GTK_LISP_WIDGETS(f) (FRAME_GTK_DATA (f)->lisp_visible_widgets)
|
|
198 #define FRAME_GTK_ICON_PIXMAP(f) (FRAME_GTK_DATA (f)->icon_pixmap)
|
|
199 #define FRAME_GTK_ICON_PIXMAP_MASK(f) (FRAME_GTK_DATA (f)->icon_pixmap_mask)
|
|
200
|
|
201 #define FRAME_GTK_GEOM_FREE_ME_PLEASE(f) (FRAME_GTK_DATA (f)->geom_free_me_please)
|
|
202
|
|
203 #define FRAME_GTK_TOTALLY_VISIBLE_P(f) (FRAME_GTK_DATA (f)->totally_visible_p)
|
|
204 #define FRAME_GTK_VISIBLE_P(f) (FRAME_GTK_DATA (f)->visible_p)
|
|
205 #define FRAME_GTK_TOP_LEVEL_FRAME_P(f) (FRAME_GTK_DATA (f)->top_level_frame_p)
|
2168
|
206 #define FRAME_GTK_WIDGET_INSTANCE_HASH_TABLE(f) (FRAME_GTK_DATA (f)->widget_instance_hash_table)
|
|
207 #define FRAME_GTK_WIDGET_CALLBACK_HASH_TABLE(f) (FRAME_GTK_DATA (f)->widget_callback_hash_table)
|
|
208 #define FRAME_GTK_WIDGET_CALLBACK_EX_HASH_TABLE(f) (FRAME_GTK_DATA (f)->widget_callback_ex_hash_table)
|
872
|
209
|
|
210 extern struct console_type *gtk_console_type;
|
|
211
|
2168
|
212 /* Special data used to quickly identify the frame that contains a widget. */
|
|
213 #define GTK_DATA_FRAME_IDENTIFIER "xemacs::frame"
|
|
214
|
|
215 /* The hashcode in the frame hash table of a tab_control tab's callback data. */
|
|
216 #define GTK_DATA_TAB_HASHCODE_IDENTIFIER "xemacs::tab_hashcode"
|
|
217
|
|
218 #define GTK_DATA_GUI_IDENTIFIER "xemacs::gui_id"
|
|
219
|
872
|
220 #endif /* HAVE_GTK */
|
|
221 #endif /* INCLUDED_console_gtk_impl_h_ */
|