Mercurial > hg > xemacs-beta
annotate src/console-gtk-impl.h @ 5287:cd167465bf69
More permission consistency.
author | Stephen J. Turnbull <stephen@xemacs.org> |
---|---|
date | Mon, 14 Jun 2010 15:03:08 +0900 |
parents | 7be849cb8828 |
children | 308d34e9f07d |
rev | line source |
---|---|
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 { | |
3092 | 52 #ifdef NEW_GC |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5120
diff
changeset
|
53 NORMAL_LISP_OBJECT_HEADER header; |
3092 | 54 #endif /* NEW_GC */ |
872 | 55 /* Gtk application info. */ |
56 GtkWidget *gtk_app_shell; | |
57 | |
58 /* Cache of GC's for frame's on this device. */ | |
59 struct gc_cache *gc_cache; | |
60 | |
61 /* Selected visual, depth and colormap for this device */ | |
62 GdkVisual *visual; | |
63 int depth; | |
64 GdkColormap *device_cmap; | |
65 | |
66 /* Used by x_bevel_modeline in redisplay-x.c */ | |
67 GdkBitmap *gray_pixmap; | |
68 | |
69 /* frame that holds the WM_COMMAND property; there should be exactly | |
70 one of these per device. */ | |
71 Lisp_Object WM_COMMAND_frame; | |
72 | |
73 /* The following items are all used exclusively in event-gtk.c. */ | |
74 int MetaMask, HyperMask, SuperMask, AltMask, ModeMask; | |
2054 | 75 KeySym lock_interpretation; |
872 | 76 |
2054 | 77 XModifierKeymap *x_modifier_keymap; |
872 | 78 |
2054 | 79 KeySym *x_keysym_map; |
872 | 80 int x_keysym_map_min_code; |
81 int x_keysym_map_max_code; | |
82 int x_keysym_map_keysyms_per_code; | |
83 Lisp_Object x_keysym_map_hashtable; | |
84 | |
85 /* #### It's not clear that there is much distinction anymore | |
86 between mouse_timestamp and global_mouse_timestamp, now that | |
87 Emacs doesn't see most (all?) events not destined for it. */ | |
88 | |
89 /* The timestamp of the last button or key event used by emacs itself. | |
90 This is used for asserting selections and input focus. */ | |
91 guint32 mouse_timestamp; | |
92 | |
93 /* This is the timestamp the last button or key event whether it was | |
94 dispatched to emacs or widgets. */ | |
95 guint32 global_mouse_timestamp; | |
96 | |
97 /* This is the last known timestamp received from the server. It is | |
98 maintained by x_event_to_emacs_event and used to patch bogus | |
99 WM_TAKE_FOCUS messages sent by Mwm. */ | |
100 guint32 last_server_timestamp; | |
101 | |
102 GdkAtom atom_WM_PROTOCOLS; | |
103 GdkAtom atom_WM_TAKE_FOCUS; | |
104 GdkAtom atom_WM_STATE; | |
105 | |
106 #if 0 | |
107 /* #### BILL!!! */ | |
108 /* stuff for sticky modifiers: */ | |
109 unsigned int need_to_add_mask, down_mask; | |
110 KeyCode last_downkey; | |
111 guint32 release_time; | |
112 #endif | |
113 }; | |
114 | |
3092 | 115 #ifdef NEW_GC |
116 typedef struct gtk_device Lisp_Gtk_Device; | |
117 | |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
3092
diff
changeset
|
118 DECLARE_LISP_OBJECT (gtk_device, Lisp_Gtk_Device); |
3092 | 119 |
120 #define XGTK_DEVICE(x) \ | |
121 XRECORD (x, gtk_device, Lisp_Gtk_Device) | |
122 #define wrap_gtk_device(p) wrap_record (p, gtk_device) | |
123 #define GTK_DEVICE_P(x) RECORDP (x, gtk_device) | |
124 #endif /* NEW_GC */ | |
125 | |
872 | 126 #define DEVICE_GTK_DATA(d) DEVICE_TYPE_DATA (d, gtk) |
127 | |
128 #define DEVICE_GTK_VISUAL(d) (DEVICE_GTK_DATA (d)->visual) | |
129 #define DEVICE_GTK_DEPTH(d) (DEVICE_GTK_DATA (d)->depth) | |
130 #define DEVICE_GTK_COLORMAP(d) (DEVICE_GTK_DATA (d)->device_cmap) | |
131 #define DEVICE_GTK_APP_SHELL(d) (DEVICE_GTK_DATA (d)->gtk_app_shell) | |
132 #define DEVICE_GTK_GC_CACHE(d) (DEVICE_GTK_DATA (d)->gc_cache) | |
133 #define DEVICE_GTK_GRAY_PIXMAP(d) (DEVICE_GTK_DATA (d)->gray_pixmap) | |
134 #define DEVICE_GTK_WM_COMMAND_FRAME(d) (DEVICE_GTK_DATA (d)->WM_COMMAND_frame) | |
135 #define DEVICE_GTK_MOUSE_TIMESTAMP(d) (DEVICE_GTK_DATA (d)->mouse_timestamp) | |
136 #define DEVICE_GTK_GLOBAL_MOUSE_TIMESTAMP(d) (DEVICE_GTK_DATA (d)->global_mouse_timestamp) | |
137 #define DEVICE_GTK_LAST_SERVER_TIMESTAMP(d) (DEVICE_GTK_DATA (d)->last_server_timestamp) | |
138 | |
139 /* The maximum number of widgets that can be displayed above the text | |
140 area at one time. Currently no more than 3 will ever actually be | |
141 displayed (menubar, psheet, debugger panel). */ | |
142 #define MAX_CONCURRENT_TOP_WIDGETS 8 | |
143 | |
144 struct gtk_frame | |
145 { | |
3092 | 146 #ifdef NEW_GC |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5120
diff
changeset
|
147 NORMAL_LISP_OBJECT_HEADER header; |
3092 | 148 #endif /* NEW_GC */ |
149 | |
872 | 150 /* The widget of this frame. */ |
151 GtkWidget *widget; /* This is really a GtkWindow */ | |
152 | |
153 /* The layout manager */ | |
154 GtkWidget *container; /* actually a GtkVBox. */ | |
155 | |
156 /* The widget of the menubar */ | |
157 GtkWidget *menubar_widget; | |
158 | |
159 /* The widget of the edit portion of this frame; this is a GtkDrawingArea, | |
160 and the window of this widget is what the redisplay code draws on. */ | |
161 GtkWidget *edit_widget; | |
5080
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
3092
diff
changeset
|
162 /* #### WARNING: this does not currently work. -- dvl |
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
3092
diff
changeset
|
163 Position of the edit widget above, for absolute background placement. |
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
3092
diff
changeset
|
164 |
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
3092
diff
changeset
|
165 int x, y; |
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
3092
diff
changeset
|
166 */ |
872 | 167 |
168 /* Lists the widgets above the text area, in the proper order. */ | |
169 GtkWidget *top_widgets[MAX_CONCURRENT_TOP_WIDGETS]; | |
170 int num_top_widgets; | |
171 | |
172 /* Our container widget as a Lisp_Object */ | |
1204 | 173 Lisp_Object lisp_visible_widgets[3]; |
872 | 174 |
1346 | 175 Lisp_Object menubar_data; |
872 | 176 |
177 /* The icon pixmaps; these are Lisp_Image_Instance objects, or Qnil. */ | |
178 Lisp_Object icon_pixmap; | |
179 Lisp_Object icon_pixmap_mask; | |
180 | |
181 /* geometry string that ought to be freed. */ | |
182 char *geom_free_me_please; | |
183 | |
184 /* 1 if the frame is completely visible on the display, 0 otherwise. | |
185 if 0 the frame may have been iconified or may be totally | |
186 or partially hidden by another X window */ | |
187 unsigned int totally_visible_p :1; | |
188 | |
189 /* Is it visible at all? */ | |
190 unsigned int visible_p :1; | |
191 | |
192 /* Are we a top-level frame? This means that our shell is a | |
193 TopLevelShell, and we should do certain things to interact with | |
194 the window manager. */ | |
195 unsigned int top_level_frame_p :1; | |
196 | |
197 /* Are we iconfied right now? */ | |
198 unsigned int iconified_p :1; | |
199 | |
2168 | 200 /* Data for widget callbacks. It is impossible to pass all the necessary |
201 data through the GTK signal API so instead it is registered here and the | |
202 hash key is passed instead. */ | |
203 Lisp_Object widget_instance_hash_table; | |
204 Lisp_Object widget_callback_hash_table; | |
205 Lisp_Object widget_callback_ex_hash_table; | |
872 | 206 }; |
207 | |
3092 | 208 #ifdef NEW_GC |
209 typedef struct gtk_frame Lisp_Gtk_Frame; | |
210 | |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
3092
diff
changeset
|
211 DECLARE_LISP_OBJECT (gtk_frame, Lisp_Gtk_Frame); |
3092 | 212 |
213 #define XGTK_FRAME(x) \ | |
214 XRECORD (x, gtk_frame, Lisp_Gtk_Frame) | |
215 #define wrap_gtk_frame(p) wrap_record (p, gtk_frame) | |
216 #define GTK_FRAME_P(x) RECORDP (x, gtk_frame) | |
217 #endif /* NEW_GC */ | |
218 | |
872 | 219 #define FRAME_GTK_DATA(f) FRAME_TYPE_DATA (f, gtk) |
220 | |
5080
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
3092
diff
changeset
|
221 /* #### WARNING: this does not currently work. -- dvl |
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
3092
diff
changeset
|
222 #define FRAME_GTK_X(f) (FRAME_GTK_DATA (f)->x) |
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
3092
diff
changeset
|
223 #define FRAME_GTK_Y(f) (FRAME_GTK_DATA (f)->y) |
5502045ec510
The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents:
3092
diff
changeset
|
224 */ |
872 | 225 #define FRAME_GTK_SHELL_WIDGET(f) (FRAME_GTK_DATA (f)->widget) |
226 #define FRAME_GTK_CONTAINER_WIDGET(f) (FRAME_GTK_DATA (f)->container) | |
227 #define FRAME_GTK_MENUBAR_WIDGET(f) (FRAME_GTK_DATA (f)->menubar_widget) | |
228 #define FRAME_GTK_TEXT_WIDGET(f) (FRAME_GTK_DATA (f)->edit_widget) | |
229 #define FRAME_GTK_TOP_WIDGETS(f) (FRAME_GTK_DATA (f)->top_widgets) | |
230 #define FRAME_GTK_NUM_TOP_WIDGETS(f) (FRAME_GTK_DATA (f)->num_top_widgets) | |
231 #define FRAME_GTK_ICONIFIED_P(f) (FRAME_GTK_DATA (f)->iconfigied_p) | |
232 | |
1346 | 233 #define FRAME_GTK_MENUBAR_DATA(f) (FRAME_GTK_DATA (f)->menubar_data) |
234 | |
872 | 235 #define FRAME_GTK_LISP_WIDGETS(f) (FRAME_GTK_DATA (f)->lisp_visible_widgets) |
236 #define FRAME_GTK_ICON_PIXMAP(f) (FRAME_GTK_DATA (f)->icon_pixmap) | |
237 #define FRAME_GTK_ICON_PIXMAP_MASK(f) (FRAME_GTK_DATA (f)->icon_pixmap_mask) | |
238 | |
239 #define FRAME_GTK_GEOM_FREE_ME_PLEASE(f) (FRAME_GTK_DATA (f)->geom_free_me_please) | |
240 | |
241 #define FRAME_GTK_TOTALLY_VISIBLE_P(f) (FRAME_GTK_DATA (f)->totally_visible_p) | |
242 #define FRAME_GTK_VISIBLE_P(f) (FRAME_GTK_DATA (f)->visible_p) | |
243 #define FRAME_GTK_TOP_LEVEL_FRAME_P(f) (FRAME_GTK_DATA (f)->top_level_frame_p) | |
2168 | 244 #define FRAME_GTK_WIDGET_INSTANCE_HASH_TABLE(f) (FRAME_GTK_DATA (f)->widget_instance_hash_table) |
245 #define FRAME_GTK_WIDGET_CALLBACK_HASH_TABLE(f) (FRAME_GTK_DATA (f)->widget_callback_hash_table) | |
246 #define FRAME_GTK_WIDGET_CALLBACK_EX_HASH_TABLE(f) (FRAME_GTK_DATA (f)->widget_callback_ex_hash_table) | |
872 | 247 |
248 extern struct console_type *gtk_console_type; | |
249 | |
2168 | 250 /* Special data used to quickly identify the frame that contains a widget. */ |
251 #define GTK_DATA_FRAME_IDENTIFIER "xemacs::frame" | |
252 | |
253 /* The hashcode in the frame hash table of a tab_control tab's callback data. */ | |
254 #define GTK_DATA_TAB_HASHCODE_IDENTIFIER "xemacs::tab_hashcode" | |
255 | |
256 #define GTK_DATA_GUI_IDENTIFIER "xemacs::gui_id" | |
257 | |
872 | 258 #endif /* HAVE_GTK */ |
259 #endif /* INCLUDED_console_gtk_impl_h_ */ |