Mercurial > hg > xemacs-beta
annotate src/frame-gtk.c @ 5887:6eca500211f4
Prototype for X509_check_host() has changed, detect this in configure.ac
ChangeLog addition:
2015-04-09 Aidan Kehoe <kehoea@parhasard.net>
* configure.ac:
If X509_check_host() is available, check the number of arguments
it takes. Don't use it if it takes any number of arguments other
than five. Also don't use it if <openssl/x509v3.h> does not
declare it, since if that is so there is no portable way to tell
how many arguments it should take, and so we would end up smashing
the stack.
* configure: Regenerate.
src/ChangeLog addition:
2015-04-09 Aidan Kehoe <kehoea@parhasard.net>
* tls.c:
#include <openssl/x509v3.h> for its prototype for
X509_check_host().
* tls.c (tls_open):
Pass the new fifth argument to X509_check_host().
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Thu, 09 Apr 2015 14:27:02 +0100 |
parents | 56144c8593a8 |
children |
rev | line source |
---|---|
2168 | 1 /* Functions for the GTK toolkit. |
462 | 2 Copyright (C) 1989, 1992-5, 1997 Free Software Foundation, Inc. |
5043 | 3 Copyright (C) 1995, 1996, 2002, 2003, 2010 Ben Wing. |
462 | 4 |
5 This file is part of XEmacs. | |
6 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
7 XEmacs is free software: you can redistribute it and/or modify it |
462 | 8 under the terms of the GNU General Public License as published by the |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
9 Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
10 option) any later version. |
462 | 11 |
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 | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
18 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
462 | 19 |
20 /* Synched up with: Not synched with FSF. */ | |
21 | |
22 /* Substantially rewritten for XEmacs. */ | |
23 /* Revamped to use Gdk/Gtk by William Perry */ | |
24 | |
25 #include <config.h> | |
26 #include "lisp.h" | |
27 | |
872 | 28 #include "buffer.h" |
29 #include "device-impl.h" | |
30 #include "events.h" | |
31 #include "extents.h" | |
32 #include "faces.h" | |
33 #include "frame-impl.h" | |
34 #include "window.h" | |
35 | |
36 #ifdef HAVE_DRAGNDROP | |
37 #include "dragdrop.h" | |
38 #endif | |
39 | |
2168 | 40 #include "elhash.h" |
872 | 41 #include "console-gtk-impl.h" |
462 | 42 #include "glyphs-gtk.h" |
5176
8b2f75cecb89
rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents:
5047
diff
changeset
|
43 #include "fontcolor-gtk-impl.h" |
462 | 44 #include "scrollbar-gtk.h" |
872 | 45 #include "ui-gtk.h" |
462 | 46 |
47 #include "gtk-xemacs.h" | |
48 | |
49 #ifdef HAVE_GNOME | |
50 #include <libgnomeui/libgnomeui.h> | |
51 #endif | |
52 | |
53 #define BORDER_WIDTH 0 | |
54 #define INTERNAL_BORDER_WIDTH 0 | |
55 | |
56 #define TRANSIENT_DATA_IDENTIFIER "xemacs::transient_for" | |
57 #define UNMAPPED_DATA_IDENTIFIER "xemacs::initially_unmapped" | |
58 | |
59 #define STUPID_X_SPECIFIC_GTK_STUFF | |
60 | |
61 #ifdef STUPID_X_SPECIFIC_GTK_STUFF | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4906
diff
changeset
|
62 #include "sysgdkx.h" |
462 | 63 #endif |
64 | |
65 /* Default properties to use when creating frames. */ | |
66 Lisp_Object Vdefault_gtk_frame_plist; | |
67 | |
68 Lisp_Object Qdetachable_menubar; | |
69 Lisp_Object Qtext_widget; | |
70 Lisp_Object Qcontainer_widget; | |
71 Lisp_Object Qshell_widget; | |
72 | |
73 #ifdef STUPID_X_SPECIFIC_GTK_STUFF | |
74 EXFUN (Fgtk_window_id, 1); | |
75 #endif | |
76 | |
77 #ifdef HAVE_DRAGNDROP | |
78 enum { | |
79 TARGET_TYPE_STRING, | |
80 TARGET_TYPE_URI_LIST, | |
81 }; | |
82 | |
83 static GtkTargetEntry dnd_target_table[] = { | |
84 { "STRING", 0, TARGET_TYPE_STRING }, | |
85 { "text/plain", 0, TARGET_TYPE_STRING }, | |
86 { "text/uri-list", 0, TARGET_TYPE_URI_LIST }, | |
87 { "_NETSCAPE_URL", 0, TARGET_TYPE_STRING } | |
88 }; | |
89 | |
90 static guint dnd_n_targets = sizeof(dnd_target_table) / sizeof(dnd_target_table[0]); | |
91 | |
92 #endif | |
93 | |
1204 | 94 static const struct memory_description gtk_frame_data_description_1 [] = { |
95 { XD_LISP_OBJECT, offsetof (struct gtk_frame, icon_pixmap) }, | |
96 { XD_LISP_OBJECT, offsetof (struct gtk_frame, icon_pixmap_mask) }, | |
97 { XD_LISP_OBJECT_ARRAY, offsetof (struct gtk_frame, lisp_visible_widgets), | |
98 3 }, | |
1346 | 99 { XD_LISP_OBJECT, offsetof (struct gtk_frame, menubar_data) }, |
1204 | 100 { XD_END } |
101 }; | |
102 | |
3092 | 103 #ifdef NEW_GC |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4117
diff
changeset
|
104 DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("gtk-frame", gtk_frame, |
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4117
diff
changeset
|
105 0, gtk_frame_data_description_1, |
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4117
diff
changeset
|
106 Lisp_Gtk_Frame); |
3092 | 107 #else /* not NEW_GC */ |
1204 | 108 extern const struct sized_memory_description gtk_frame_data_description; |
109 | |
110 const struct sized_memory_description gtk_frame_data_description = { | |
111 sizeof (struct gtk_frame), gtk_frame_data_description_1 | |
112 }; | |
3092 | 113 #endif /* not NEW_GC */ |
1204 | 114 |
462 | 115 |
116 /************************************************************************/ | |
117 /* helper functions */ | |
118 /************************************************************************/ | |
119 | |
2168 | 120 /* Return the Emacs frame-object which contains the given widget. */ |
121 struct frame * | |
122 gtk_widget_to_frame (GtkWidget *w) | |
123 { | |
124 struct frame *f = NULL; | |
125 | |
126 for (; w; w = w->parent) | |
127 { | |
128 if ((f = (struct frame *) gtk_object_get_data (GTK_OBJECT (w), | |
129 GTK_DATA_FRAME_IDENTIFIER))) | |
130 return (f); | |
131 } | |
132 | |
133 return (selected_frame()); | |
134 } | |
135 | |
136 | |
462 | 137 /* Return the Emacs frame-object corresponding to an X window */ |
138 struct frame * | |
139 gtk_window_to_frame (struct device *d, GdkWindow *wdesc) | |
140 { | |
141 Lisp_Object tail, frame; | |
142 struct frame *f; | |
143 | |
144 /* This function was previously written to accept only a window argument | |
145 (and to loop over all devices looking for a matching window), but | |
146 that is incorrect because window ID's are not unique across displays. */ | |
147 | |
148 for (tail = DEVICE_FRAME_LIST (d); CONSP (tail); tail = XCDR (tail)) | |
149 { | |
150 frame = XCAR (tail); | |
151 if (!FRAMEP (frame)) | |
152 continue; | |
153 f = XFRAME (frame); | |
154 if (FRAME_GTK_P (f) && GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f)) == wdesc) | |
155 return f; | |
156 } | |
157 return 0; | |
158 } | |
159 | |
160 /* Like gtk_window_to_frame but also compares the window with the widget's | |
161 windows */ | |
162 struct frame * | |
163 gtk_any_window_to_frame (struct device *d, GdkWindow *w) | |
164 { | |
165 do | |
166 { | |
167 Lisp_Object frmcons; | |
168 | |
169 DEVICE_FRAME_LOOP (frmcons, d) | |
170 { | |
171 struct frame *fr = XFRAME (XCAR (frmcons)); | |
172 if ((w == GET_GTK_WIDGET_WINDOW (FRAME_GTK_SHELL_WIDGET (fr))) || | |
173 (w == GET_GTK_WIDGET_WINDOW (FRAME_GTK_CONTAINER_WIDGET (fr))) || | |
174 #ifdef HAVE_MENUBARS | |
175 (w == GET_GTK_WIDGET_WINDOW (FRAME_GTK_MENUBAR_WIDGET (fr))) || | |
176 #endif | |
177 (w == GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (fr)))) | |
178 { | |
179 return (fr); | |
180 } | |
181 } | |
182 w = gdk_window_get_parent (w); | |
183 } while (w); | |
184 | |
185 return (0); | |
186 } | |
187 | |
188 struct frame * | |
189 gtk_any_widget_or_parent_to_frame (struct device *d, GtkWidget *widget) | |
190 { | |
191 return (gtk_any_window_to_frame (d, GET_GTK_WIDGET_WINDOW (widget))); | |
192 } | |
193 | |
194 struct device * | |
195 gtk_any_window_to_device (GdkWindow *w) | |
196 { | |
197 struct device *d = NULL; | |
198 Lisp_Object devcons, concons; | |
199 | |
200 DEVICE_LOOP_NO_BREAK (devcons, concons) | |
201 { | |
202 d = XDEVICE (XCAR (devcons)); | |
203 if (!DEVICE_GTK_P (d)) continue; | |
204 if (gtk_any_window_to_frame (d, w)) | |
205 return (d); | |
206 } | |
207 return (NULL); | |
208 } | |
209 | |
210 struct frame * | |
211 decode_gtk_frame (Lisp_Object frame) | |
212 { | |
213 if (NILP (frame)) | |
793 | 214 frame = wrap_frame (selected_frame ()); |
462 | 215 CHECK_LIVE_FRAME (frame); |
216 /* this will also catch dead frames, but putting in the above check | |
217 results in a more useful error */ | |
218 CHECK_GTK_FRAME (frame); | |
219 return XFRAME (frame); | |
220 } | |
221 | |
222 | |
223 /************************************************************************/ | |
224 /* window-manager interactions */ | |
225 /************************************************************************/ | |
226 static int | |
227 gtk_frame_iconified_p (struct frame *f) | |
228 { | |
229 return (f->iconified); | |
230 } | |
231 | |
232 | |
233 /************************************************************************/ | |
234 /* frame properties */ | |
235 /************************************************************************/ | |
236 | |
237 static Lisp_Object | |
238 gtk_frame_property (struct frame *f, Lisp_Object property) | |
239 { | |
240 GtkWidget *shell = FRAME_GTK_SHELL_WIDGET (f); | |
241 | |
242 if (EQ (Qleft, property) || EQ (Qtop, property)) | |
243 { | |
244 gint x, y; | |
245 if (!GET_GTK_WIDGET_WINDOW(shell)) | |
246 return Qzero; | |
247 gdk_window_get_deskrelative_origin (GET_GTK_WIDGET_WINDOW (shell), &x, &y); | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5474
diff
changeset
|
248 if (EQ (Qleft, property)) return make_fixnum (x); |
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5474
diff
changeset
|
249 if (EQ (Qtop, property)) return make_fixnum (y); |
462 | 250 } |
251 if (EQ (Qshell_widget, property)) | |
252 { | |
253 return (FRAME_GTK_LISP_WIDGETS (f)[0]); | |
254 } | |
255 if (EQ (Qcontainer_widget, property)) | |
256 { | |
257 return (FRAME_GTK_LISP_WIDGETS (f)[1]); | |
258 } | |
259 if (EQ (Qtext_widget, property)) | |
260 { | |
261 return (FRAME_GTK_LISP_WIDGETS (f)[2]); | |
262 } | |
263 #ifdef STUPID_X_SPECIFIC_GTK_STUFF | |
264 if (EQ (Qwindow_id, property)) | |
771 | 265 return Fgtk_window_id (wrap_frame (f)); |
462 | 266 #endif |
267 | |
268 return Qunbound; | |
269 } | |
270 | |
271 static int | |
3087 | 272 gtk_internal_frame_property_p (struct frame *UNUSED(f), Lisp_Object property) |
462 | 273 { |
274 return EQ (property, Qleft) | |
275 || EQ (property, Qtop) | |
276 || EQ (Qshell_widget, property) | |
277 || EQ (Qcontainer_widget, property) | |
278 || EQ (Qtext_widget, property) | |
279 || EQ (property, Qwindow_id) | |
280 || STRINGP (property); | |
281 } | |
282 | |
283 static Lisp_Object | |
284 gtk_frame_properties (struct frame *f) | |
285 { | |
286 Lisp_Object props = Qnil; | |
287 GtkWidget *shell = FRAME_GTK_SHELL_WIDGET (f); | |
288 gint x, y; | |
289 | |
290 props = cons3 (Qshell_widget, FRAME_GTK_LISP_WIDGETS (f)[0], props); | |
291 props = cons3 (Qcontainer_widget, FRAME_GTK_LISP_WIDGETS (f)[1], props); | |
292 props = cons3 (Qtext_widget, FRAME_GTK_LISP_WIDGETS (f)[2], props); | |
293 | |
294 #ifdef STUPID_X_SPECIFIC_GTK_STUFF | |
771 | 295 props = cons3 (Qwindow_id, Fgtk_window_id (wrap_frame (f)), props); |
462 | 296 #endif |
297 | |
298 if (!GET_GTK_WIDGET_WINDOW (shell)) | |
299 x = y = 0; | |
300 else | |
301 gdk_window_get_deskrelative_origin (GET_GTK_WIDGET_WINDOW (shell), &x, &y); | |
302 | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5474
diff
changeset
|
303 props = cons3 (Qtop, make_fixnum (y), props); |
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5474
diff
changeset
|
304 props = cons3 (Qleft, make_fixnum (x), props); |
462 | 305 |
306 return props; | |
307 } | |
308 | |
309 | |
310 /* Functions called only from `gtk_set_frame_properties' to set | |
311 individual properties. */ | |
312 | |
313 static void | |
2286 | 314 gtk_set_frame_text_value (struct frame *UNUSED (f), Ibyte *value, |
462 | 315 void (*func) (gpointer, gchar *), |
316 gpointer arg) | |
317 { | |
318 gchar *the_text = (gchar *) value; | |
319 | |
320 /* Programmer fuckup or window is not realized yet. */ | |
321 if (!func || !arg) return; | |
322 | |
323 #ifdef MULE | |
324 { | |
867 | 325 Ibyte *ptr; |
462 | 326 |
327 /* Optimize for common ASCII case */ | |
328 for (ptr = value; *ptr; ptr++) | |
826 | 329 if (!byte_ascii_p (*ptr)) |
462 | 330 { |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4962
diff
changeset
|
331 char *tmp = ITEXT_TO_EXTERNAL (value, Qctext); |
462 | 332 the_text = tmp; |
333 break; | |
334 } | |
335 } | |
336 #endif /* MULE */ | |
337 | |
338 (*func) (arg, (gchar *) the_text); | |
339 } | |
340 | |
341 static void | |
867 | 342 gtk_set_title_from_ibyte (struct frame *f, Ibyte *name) |
462 | 343 { |
344 if (GTK_IS_WINDOW (FRAME_GTK_SHELL_WIDGET (f))) | |
345 gtk_set_frame_text_value (f, name, | |
346 (void (*)(gpointer, gchar *)) | |
347 gtk_window_set_title, FRAME_GTK_SHELL_WIDGET (f)); | |
348 } | |
349 | |
350 static void | |
867 | 351 gtk_set_icon_name_from_ibyte (struct frame *f, Ibyte *name) |
462 | 352 { |
353 gtk_set_frame_text_value (f, name, | |
354 (void (*)(gpointer, gchar *)) | |
355 gdk_window_set_icon_name, FRAME_GTK_SHELL_WIDGET (f)->window); | |
356 } | |
357 | |
358 /* Set the initial frame size as specified. This function is used | |
359 when the frame's widgets have not yet been realized. | |
360 */ | |
361 static void | |
362 gtk_set_initial_frame_size (struct frame *f, int x, int y, | |
363 unsigned int w, unsigned int h) | |
364 { | |
365 GtkWidget *shell = FRAME_GTK_SHELL_WIDGET (f); | |
366 GdkGeometry geometry; | |
367 | |
368 if (GTK_IS_WINDOW (shell)) | |
369 { | |
2054 | 370 GdkWindowHints geometry_mask = GDK_HINT_RESIZE_INC; |
462 | 371 /* Deal with the cell size */ |
5047
07dcc7000bbf
put width before height consistently, fix a real bug found in the process
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
372 default_face_width_and_height (wrap_frame (f), &geometry.width_inc, &geometry.height_inc); |
462 | 373 |
374 gtk_window_set_geometry_hints (GTK_WINDOW (shell), | |
375 FRAME_GTK_TEXT_WIDGET (f), &geometry, geometry_mask); | |
376 gdk_window_set_hints (GET_GTK_WIDGET_WINDOW (shell), x, y, 0, 0, 0, 0, GDK_HINT_POS); | |
377 gtk_window_set_policy (GTK_WINDOW (shell), TRUE, TRUE, FALSE); | |
378 } | |
379 | |
380 FRAME_HEIGHT (f) = h; | |
381 FRAME_WIDTH (f) = w; | |
382 | |
5043 | 383 change_frame_size (f, w, h, 0); |
462 | 384 { |
385 GtkRequisition req; | |
386 | |
387 gtk_widget_size_request (FRAME_GTK_SHELL_WIDGET (f), &req); | |
388 gtk_widget_set_usize (FRAME_GTK_SHELL_WIDGET (f), req.width, req.height); | |
389 } | |
390 } | |
391 | |
392 /* Report that a frame property of frame S is being set or changed. | |
393 If the property is not specially recognized, do nothing. | |
394 */ | |
395 | |
396 static void | |
397 gtk_set_frame_properties (struct frame *f, Lisp_Object plist) | |
398 { | |
399 gint x, y; | |
400 gint width = 0, height = 0; | |
401 gboolean width_specified_p = FALSE; | |
402 gboolean height_specified_p = FALSE; | |
403 gboolean x_position_specified_p = FALSE; | |
404 gboolean y_position_specified_p = FALSE; | |
405 Lisp_Object tail; | |
406 | |
407 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail))) | |
408 { | |
409 Lisp_Object prop = Fcar (tail); | |
410 Lisp_Object val = Fcar (Fcdr (tail)); | |
411 | |
412 if (SYMBOLP (prop)) | |
413 { | |
414 if (EQ (prop, Qfont)) | |
415 { | |
416 /* If the value is not a string we silently ignore it. */ | |
417 if (STRINGP (val)) | |
418 { | |
419 Lisp_Object frm, font_spec; | |
420 | |
793 | 421 frm = wrap_frame (f); |
462 | 422 font_spec = Fget (Fget_face (Qdefault), Qfont, Qnil); |
423 | |
424 Fadd_spec_to_specifier (font_spec, val, frm, Qnil, Qnil); | |
425 update_frame_face_values (f); | |
426 } | |
427 continue; | |
428 } | |
429 else if (EQ (prop, Qwidth)) | |
430 { | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5474
diff
changeset
|
431 CHECK_FIXNUM (val); |
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5474
diff
changeset
|
432 width = XFIXNUM (val); |
462 | 433 width_specified_p = TRUE; |
434 continue; | |
435 } | |
436 else if (EQ (prop, Qheight)) | |
437 { | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5474
diff
changeset
|
438 CHECK_FIXNUM (val); |
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5474
diff
changeset
|
439 height = XFIXNUM (val); |
462 | 440 height_specified_p = TRUE; |
441 continue; | |
442 } | |
443 /* Further kludge the x/y. */ | |
444 else if (EQ (prop, Qx)) | |
445 { | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5474
diff
changeset
|
446 CHECK_FIXNUM (val); |
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5474
diff
changeset
|
447 x = (gint) XFIXNUM (val); |
462 | 448 x_position_specified_p = TRUE; |
449 continue; | |
450 } | |
451 else if (EQ (prop, Qy)) | |
452 { | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5474
diff
changeset
|
453 CHECK_FIXNUM (val); |
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5474
diff
changeset
|
454 y = (gint) XFIXNUM (val); |
462 | 455 y_position_specified_p = TRUE; |
456 continue; | |
457 } | |
458 } | |
459 } | |
460 | |
461 /* Kludge kludge kludge. We need to deal with the size and position | |
462 specially. */ | |
463 { | |
464 int size_specified_p = width_specified_p || height_specified_p; | |
465 int position_specified_p = x_position_specified_p || y_position_specified_p; | |
466 | |
467 if (!width_specified_p) | |
468 width = 80; | |
469 if (!height_specified_p) | |
470 height = 30; | |
471 | |
472 /* Kludge kludge kludge kludge. */ | |
473 if (position_specified_p && | |
474 (!x_position_specified_p || !y_position_specified_p)) | |
475 { | |
476 gint dummy; | |
477 GtkWidget *shell = FRAME_GTK_SHELL_WIDGET (f); | |
478 gdk_window_get_deskrelative_origin (GET_GTK_WIDGET_WINDOW (shell), | |
479 (x_position_specified_p ? &dummy : &x), | |
480 (y_position_specified_p ? &dummy : &y)); | |
481 } | |
482 | |
483 if (!f->init_finished) | |
484 { | |
485 if (size_specified_p || position_specified_p) | |
486 gtk_set_initial_frame_size (f, x, y, width, height); | |
487 } | |
488 else | |
489 { | |
490 if (size_specified_p) | |
491 { | |
793 | 492 Lisp_Object frame = wrap_frame (f); |
493 | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5474
diff
changeset
|
494 Fset_frame_size (frame, make_fixnum (width), make_fixnum (height), Qnil); |
462 | 495 } |
496 if (position_specified_p) | |
497 { | |
793 | 498 Lisp_Object frame = wrap_frame (f); |
499 | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5474
diff
changeset
|
500 Fset_frame_position (frame, make_fixnum (x), make_fixnum (y)); |
462 | 501 } |
502 } | |
503 } | |
504 } | |
505 | |
506 | |
507 /************************************************************************/ | |
508 /* widget creation */ | |
509 /************************************************************************/ | |
510 /* Figure out what size the shell widget should initially be, | |
511 and set it. Should be called after the default font has been | |
512 determined but before the widget has been realized. */ | |
513 | |
514 extern Lisp_Object Vgtk_initial_geometry; | |
515 | |
516 #ifndef HAVE_GNOME | |
517 static int | |
518 get_number (const char **geometry) | |
519 { | |
520 int value = 0; | |
521 int mult = 1; | |
522 | |
523 if (**geometry == '-'){ | |
524 mult = -1; | |
525 (*geometry)++; | |
526 } | |
527 while (**geometry && isdigit (**geometry)){ | |
528 value = value * 10 + (**geometry - '0'); | |
529 (*geometry)++; | |
530 } | |
531 return value * mult; | |
532 } | |
533 | |
534 /* | |
535 */ | |
536 | |
537 /** | |
538 * gnome_parse_geometry | |
539 * @geometry: geometry string to be parsed | |
540 * @xpos: X position geometry component | |
541 * @ypos: Y position geometry component | |
542 * @width: pixel width geometry component | |
543 * @height: pixel height geometry component | |
544 * | |
545 * Description: | |
546 * Parses the geometry string passed in @geometry, and fills | |
547 * @xpos, @ypos, @width, and @height with | |
548 * the corresponding values upon completion of the parse. | |
549 * If the parse fails, it should be assumed that @xpos, @ypos, @width, | |
550 * and @height contain undefined values. | |
551 * | |
552 * Returns: | |
553 * %TRUE if the geometry was successfully parsed, %FALSE otherwise. | |
554 **/ | |
555 | |
556 static gboolean | |
557 gnome_parse_geometry (const gchar *geometry, gint *xpos, | |
558 gint *ypos, gint *width, gint *height) | |
559 { | |
560 int subtract; | |
561 | |
562 g_return_val_if_fail (xpos != NULL, FALSE); | |
563 g_return_val_if_fail (ypos != NULL, FALSE); | |
564 g_return_val_if_fail (width != NULL, FALSE); | |
565 g_return_val_if_fail (height != NULL, FALSE); | |
566 | |
567 *xpos = *ypos = *width = *height = -1; | |
568 | |
569 if (!geometry) | |
570 return FALSE; | |
571 | |
572 if (*geometry == '=') | |
573 geometry++; | |
574 if (!*geometry) | |
575 return FALSE; | |
576 if (isdigit (*geometry)) | |
577 *width = get_number (&geometry); | |
578 if (!*geometry) | |
579 return TRUE; | |
580 if (*geometry == 'x' || *geometry == 'X'){ | |
581 geometry++; | |
582 *height = get_number (&geometry); | |
583 } | |
584 if (!*geometry) | |
585 return 1; | |
586 if (*geometry == '+'){ | |
587 subtract = 0; | |
588 geometry++; | |
589 } else if (*geometry == '-'){ | |
590 subtract = gdk_screen_width (); | |
591 geometry++; | |
592 } else | |
593 return FALSE; | |
594 *xpos = get_number (&geometry); | |
595 if (subtract) | |
596 *xpos = subtract - *xpos; | |
597 if (!*geometry) | |
598 return TRUE; | |
599 if (*geometry == '+'){ | |
600 subtract = 0; | |
601 geometry++; | |
602 } else if (*geometry == '-'){ | |
603 subtract = gdk_screen_height (); | |
604 geometry++; | |
605 } else | |
606 return FALSE; | |
607 *ypos = get_number (&geometry); | |
608 if (subtract) | |
609 *ypos = subtract - *ypos; | |
610 return TRUE; | |
611 } | |
612 #endif | |
613 | |
614 static void | |
615 gtk_initialize_frame_size (struct frame *f) | |
616 { | |
617 gint x = 10, y = 10, w = 80, h = 30; | |
618 | |
619 if (STRINGP (Vgtk_initial_geometry)) | |
620 { | |
2054 | 621 if (!gnome_parse_geometry ((char*) XSTRING_DATA (Vgtk_initial_geometry), &x,&y,&w,&h)) |
462 | 622 { |
623 x = y = 10; | |
624 w = 80; | |
625 h = 30; | |
626 } | |
627 } | |
628 | |
629 /* set the position of the frame's root window now. When the | |
630 frame was created, the position was initialized to (0,0). */ | |
631 { | |
632 struct window *win = XWINDOW (f->root_window); | |
633 | |
5090 | 634 WINDOW_LEFT (win) = FRAME_PANED_LEFT_EDGE (f); |
635 WINDOW_TOP (win) = FRAME_PANED_TOP_EDGE (f); | |
462 | 636 |
637 if (!NILP (f->minibuffer_window)) | |
638 { | |
639 win = XWINDOW (f->minibuffer_window); | |
5090 | 640 WINDOW_LEFT (win) = FRAME_PANED_LEFT_EDGE (f); |
462 | 641 } |
642 } | |
643 | |
644 gtk_set_initial_frame_size (f, x, y, w, h); | |
645 } | |
646 | |
647 static gboolean | |
2286 | 648 resize_event_cb (GtkWidget *UNUSED (w), GtkAllocation *allocation, |
649 gpointer user_data) | |
462 | 650 { |
651 struct frame *f = (struct frame *) user_data; | |
652 | |
653 f->pixwidth = allocation->width; | |
654 f->pixheight = allocation->height; | |
655 | |
656 if (FRAME_GTK_TEXT_WIDGET (f)->window) | |
657 { | |
793 | 658 Lisp_Object frame = wrap_frame (f); |
659 | |
462 | 660 Fredraw_frame (frame, Qt); |
661 } | |
662 | |
663 return (FALSE); | |
664 } | |
665 | |
666 static gboolean | |
2286 | 667 delete_event_cb (GtkWidget *UNUSED (w), GdkEvent *UNUSED (ev), |
668 gpointer user_data) | |
462 | 669 { |
670 struct frame *f = (struct frame *) user_data; | |
793 | 671 Lisp_Object frame = wrap_frame (f); |
462 | 672 |
673 enqueue_misc_user_event (frame, Qeval, list3 (Qdelete_frame, frame, Qt)); | |
674 | |
675 /* See if tickling the event queue helps us with our delays when | |
676 clicking 'close' */ | |
677 signal_fake_event (); | |
678 | |
679 return (TRUE); | |
680 } | |
681 | |
682 extern gboolean emacs_shell_event_handler (GtkWidget *wid, GdkEvent *event, gpointer closure); | |
683 extern Lisp_Object build_gtk_object (GtkObject *obj); | |
684 | |
685 #ifndef GNOME_IS_APP | |
686 #define GNOME_IS_APP(x) 0 | |
687 #define gnome_app_set_contents(x,y) 0 | |
688 #endif | |
689 | |
690 static void | |
691 cleanup_deleted_frame (gpointer data) | |
692 { | |
693 struct frame *f = (struct frame *) data; | |
793 | 694 Lisp_Object frame = wrap_frame (f); |
462 | 695 |
696 Fdelete_frame (frame, Qt); | |
697 } | |
698 | |
699 #ifdef HAVE_DRAGNDROP | |
700 extern void | |
701 dragndrop_data_received (GtkWidget *widget, | |
702 GdkDragContext *context, | |
703 gint x, | |
704 gint y, | |
705 GtkSelectionData *data, | |
706 guint info, | |
707 guint time); | |
708 | |
709 extern gboolean | |
710 dragndrop_dropped (GtkWidget *widget, | |
711 GdkDragContext *drag_context, | |
712 gint x, | |
713 gint y, | |
714 guint time, | |
715 gpointer user_data); | |
716 | |
717 Lisp_Object Vcurrent_drag_object; | |
718 | |
719 #define DRAG_SELECTION_DATA_ERROR "Error converting drag data to external format" | |
720 static void | |
2286 | 721 dragndrop_get_drag (GtkWidget *UNUSED (widget), |
722 GdkDragContext *UNUSED (drag_context), | |
462 | 723 GtkSelectionData *data, |
724 guint info, | |
2286 | 725 guint UNUSED (time), |
726 gpointer UNUSED (user_data)) | |
462 | 727 { |
728 gtk_selection_data_set (data, GDK_SELECTION_TYPE_STRING, 8, | |
729 DRAG_SELECTION_DATA_ERROR, | |
730 strlen (DRAG_SELECTION_DATA_ERROR)); | |
731 | |
732 switch (info) | |
733 { | |
734 case TARGET_TYPE_STRING: | |
735 { | |
736 Lisp_Object string = Vcurrent_drag_object; | |
737 | |
738 if (!STRINGP (Vcurrent_drag_object)) | |
739 { | |
740 string = Fprin1_to_string (string, Qnil); | |
741 /* Convert to a string */ | |
742 } | |
743 | |
744 gtk_selection_data_set (data, GDK_SELECTION_TYPE_STRING, | |
745 8, XSTRING_DATA (string), XSTRING_LENGTH (string)); | |
746 } | |
747 break; | |
748 case TARGET_TYPE_URI_LIST: | |
749 break; | |
750 default: | |
751 break; | |
752 } | |
753 Vcurrent_drag_object = Qnil; | |
754 } | |
755 | |
756 DEFUN ("gtk-start-drag-internal", Fgtk_start_drag_internal, 2, 3, 0, /* | |
757 Start a GTK drag from a buffer. | |
758 First arg is the event that started the drag, | |
759 second arg should be some string, and the third | |
760 is the type of the data (this should be a MIME type as a string (ie: text/plain)). | |
761 The type defaults to text/plain. | |
762 */ | |
763 (event, data, dtyp)) | |
764 { | |
765 if (EVENTP(event)) | |
766 { | |
767 struct frame *f = decode_gtk_frame (Fselected_frame (Qnil)); | |
768 GtkWidget *wid = FRAME_GTK_TEXT_WIDGET (f); | |
769 struct Lisp_Event *lisp_event = XEVENT(event); | |
770 GdkAtom dnd_typ; | |
771 GtkTargetList *tl = gtk_target_list_new (dnd_target_table, dnd_n_targets); | |
772 | |
773 /* only drag if this is really a press */ | |
774 if (EVENT_TYPE(lisp_event) != button_press_event) | |
775 return Qnil; | |
776 | |
777 /* get the desired type */ | |
778 if (!NILP (dtyp) && STRINGP (dtyp)) | |
779 dnd_typ = gdk_atom_intern (XSTRING_DATA (dtyp), FALSE); | |
780 | |
1204 | 781 gtk_drag_begin (wid, tl, GDK_ACTION_COPY, |
782 EVENT_BUTTON_BUTTON (lisp_event), NULL); | |
462 | 783 |
784 Vcurrent_drag_object = data; | |
785 | |
786 gtk_target_list_unref (tl); | |
787 } | |
788 return Qnil; | |
789 } | |
790 #endif | |
791 | |
792 /* Creates the widgets for a frame. | |
793 lisp_window_id is a Lisp description of an X window or Xt | |
794 widget to parse. | |
795 | |
796 This function does not map the windows. (That is | |
797 done by gtk_popup_frame().) | |
798 */ | |
799 static void | |
800 gtk_create_widgets (struct frame *f, Lisp_Object lisp_window_id, Lisp_Object parent) | |
801 { | |
802 const char *name; | |
803 GtkWidget *text, *container, *shell; | |
804 gboolean embedded_p = !NILP (lisp_window_id); | |
805 #ifdef HAVE_MENUBARS | |
806 int menubar_visible; | |
807 #endif | |
808 | |
809 if (STRINGP (f->name)) | |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4962
diff
changeset
|
810 name = LISP_STRING_TO_EXTERNAL (f->name, Qctext); |
462 | 811 else |
812 name = "emacs"; | |
813 | |
814 FRAME_GTK_TOP_LEVEL_FRAME_P (f) = 1; | |
815 | |
816 if (embedded_p) | |
817 { | |
818 CHECK_GTK_OBJECT (lisp_window_id); | |
819 | |
820 if (!GTK_IS_CONTAINER (XGTK_OBJECT (lisp_window_id)->object)) | |
821 { | |
563 | 822 invalid_argument ("Window ID must be a GtkContainer subclass", lisp_window_id); |
462 | 823 } |
824 | |
825 shell = gtk_vbox_new (FALSE, 0); | |
826 | |
827 gtk_object_weakref (GTK_OBJECT (shell), cleanup_deleted_frame, f); | |
828 gtk_container_add (GTK_CONTAINER (XGTK_OBJECT (lisp_window_id)->object), shell); | |
829 } | |
830 else | |
831 { | |
832 #ifdef HAVE_GNOME | |
833 shell = GTK_WIDGET (gnome_app_new ("XEmacs", "XEmacs/GNOME")); | |
834 #else | |
835 shell = GTK_WIDGET (gtk_window_new (GTK_WINDOW_TOPLEVEL)); | |
836 #endif | |
837 } | |
838 | |
839 if (!NILP (parent)) | |
840 { | |
841 /* If this is a transient window, keep the parent info around */ | |
842 GtkWidget *parentwid = FRAME_GTK_SHELL_WIDGET (XFRAME (parent)); | |
843 gtk_object_set_data (GTK_OBJECT (shell), TRANSIENT_DATA_IDENTIFIER, parentwid); | |
844 gtk_window_set_transient_for (GTK_WINDOW (shell), GTK_WINDOW (parentwid)); | |
845 } | |
846 | |
847 gtk_container_set_border_width (GTK_CONTAINER (shell), 0); | |
848 | |
2168 | 849 /* Add a mapping from widget to frame to help widget callbacks quickly find |
850 their corresponding frame. */ | |
851 gtk_object_set_data (GTK_OBJECT (shell), GTK_DATA_FRAME_IDENTIFIER, f); | |
462 | 852 |
853 FRAME_GTK_SHELL_WIDGET (f) = shell; | |
854 | |
855 text = GTK_WIDGET (gtk_xemacs_new (f)); | |
856 | |
857 if (!GNOME_IS_APP (shell)) | |
858 container = GTK_WIDGET (gtk_vbox_new (FALSE, INTERNAL_BORDER_WIDTH)); | |
859 else | |
860 container = shell; | |
861 | |
862 FRAME_GTK_CONTAINER_WIDGET (f) = container; | |
863 FRAME_GTK_TEXT_WIDGET (f) = text; | |
864 | |
865 #ifdef HAVE_DRAGNDROP | |
866 gtk_drag_dest_set (text, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT, | |
867 dnd_target_table, dnd_n_targets, | |
868 GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_ASK); | |
869 gtk_signal_connect (GTK_OBJECT (text), "drag_drop", | |
870 GTK_SIGNAL_FUNC (dragndrop_dropped), text); | |
871 gtk_signal_connect (GTK_OBJECT (text), "drag_data_received", | |
872 GTK_SIGNAL_FUNC (dragndrop_data_received), text); | |
873 gtk_signal_connect (GTK_OBJECT (text), "drag_data_get", | |
874 GTK_SIGNAL_FUNC (dragndrop_get_drag), NULL); | |
875 #endif | |
876 | |
877 #ifdef HAVE_MENUBARS | |
878 /* Create the initial menubar widget. */ | |
879 menubar_visible = gtk_initialize_frame_menubar (f); | |
880 | |
881 if (menubar_visible) | |
882 { | |
883 gtk_widget_show_all (FRAME_GTK_MENUBAR_WIDGET (f)); | |
884 } | |
885 #endif /* HAVE_MENUBARS */ | |
886 | |
887 if (GNOME_IS_APP (shell)) | |
888 gnome_app_set_contents (GNOME_APP (shell), text); | |
889 else | |
890 /* Now comes the drawing area, which should fill the rest of the | |
891 ** frame completely. | |
892 */ | |
893 gtk_box_pack_end (GTK_BOX (container), text, TRUE, TRUE, 0); | |
894 | |
895 /* Connect main event handler */ | |
896 gtk_signal_connect (GTK_OBJECT (shell), "delete-event", GTK_SIGNAL_FUNC (delete_event_cb), f); | |
897 | |
898 { | |
899 static char *events_to_frob[] = { "focus-in-event", | |
900 "focus-out-event", | |
901 "enter-notify-event", | |
902 "leave-notify-event", | |
903 "map-event", | |
904 "unmap-event", | |
905 "property-notify-event", | |
906 "selection-clear-event", | |
907 "selection-request-event", | |
908 "selection-notify-event", | |
909 "client-event", | |
910 /* "configure-event", */ | |
911 "visibility-notify-event", | |
912 NULL }; | |
913 int i; | |
914 | |
915 for (i = 0; events_to_frob[i]; i++) | |
916 { | |
917 gtk_signal_connect (GTK_OBJECT (shell), events_to_frob[i], | |
918 GTK_SIGNAL_FUNC (emacs_shell_event_handler), f); | |
919 } | |
920 } | |
921 | |
922 gtk_signal_connect (GTK_OBJECT (shell), "size-allocate", GTK_SIGNAL_FUNC (resize_event_cb), f); | |
923 | |
924 /* This might be safe to call now... */ | |
925 /* gtk_signal_connect (GTK_OBJECT (shell), "event", GTK_SIGNAL_FUNC (emacs_shell_event_handler), f); */ | |
926 | |
927 /* Let's make sure we get all the events we can */ | |
928 gtk_widget_set_events (text, GDK_ALL_EVENTS_MASK); | |
929 | |
930 if (shell != container) | |
931 gtk_container_add (GTK_CONTAINER (shell), container); | |
932 | |
933 gtk_widget_set_name (shell, "XEmacs::shell"); | |
934 gtk_widget_set_name (container, "XEmacs::container"); | |
935 gtk_widget_set_name (text, "XEmacs::text"); | |
936 | |
937 FRAME_GTK_LISP_WIDGETS(f)[0] = build_gtk_object (GTK_OBJECT (shell)); | |
938 FRAME_GTK_LISP_WIDGETS(f)[1] = build_gtk_object (GTK_OBJECT (container)); | |
939 FRAME_GTK_LISP_WIDGETS(f)[2] = build_gtk_object (GTK_OBJECT (text)); | |
940 | |
941 gtk_widget_realize (shell); | |
942 } | |
943 | |
944 /* create the windows for the specified frame and display them. | |
945 Note that the widgets have already been created, and any | |
946 necessary geometry calculations have already been done. */ | |
947 static void | |
948 gtk_popup_frame (struct frame *f) | |
949 { | |
950 /* */ | |
951 | |
952 if (gtk_object_get_data (GTK_OBJECT (FRAME_GTK_SHELL_WIDGET (f)), UNMAPPED_DATA_IDENTIFIER)) | |
953 { | |
954 FRAME_GTK_TOTALLY_VISIBLE_P (f) = 0; | |
955 f->visible = 0; | |
956 gtk_widget_realize (FRAME_GTK_SHELL_WIDGET (f)); | |
957 gtk_widget_realize (FRAME_GTK_TEXT_WIDGET (f)); | |
958 gtk_widget_hide_all (FRAME_GTK_SHELL_WIDGET (f)); | |
959 } | |
960 else | |
961 { | |
962 gtk_widget_show_all (FRAME_GTK_SHELL_WIDGET (f)); | |
963 } | |
964 } | |
965 | |
966 static void | |
967 allocate_gtk_frame_struct (struct frame *f) | |
968 { | |
1346 | 969 int i; |
970 | |
462 | 971 /* zero out all slots. */ |
3092 | 972 #ifdef NEW_GC |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5126
diff
changeset
|
973 f->frame_data = XGTK_FRAME (ALLOC_NORMAL_LISP_OBJECT (gtk_frame)); |
3092 | 974 #else /* not NEW_GC */ |
462 | 975 f->frame_data = xnew_and_zero (struct gtk_frame); |
3092 | 976 #endif /* not NEW_GC */ |
462 | 977 |
978 /* yeah, except the lisp ones */ | |
979 FRAME_GTK_ICON_PIXMAP (f) = Qnil; | |
980 FRAME_GTK_ICON_PIXMAP_MASK (f) = Qnil; | |
1346 | 981 FRAME_GTK_MENUBAR_DATA (f) = Qnil; |
982 for (i = 0; i < 3; i++) | |
983 FRAME_GTK_LISP_WIDGETS (f)[i] = Qnil; | |
2168 | 984 |
985 /* | |
4906
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4117
diff
changeset
|
986 Hashtables of callback data for glyphs on the frame. [[ Make them EQ |
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4117
diff
changeset
|
987 because we only use ints as keys. Otherwise we run into stickiness in |
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4117
diff
changeset
|
988 redisplay because internal_equal() can QUIT. See |
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4117
diff
changeset
|
989 enter_redisplay_critical_section() ]] -- probably not true any more, |
6ef8256a020a
implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents:
4117
diff
changeset
|
990 now that we have internal_equal_trapping_problems(). --ben |
2168 | 991 */ |
992 FRAME_GTK_WIDGET_INSTANCE_HASH_TABLE (f) = | |
5191
71ee43b8a74d
Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents:
5178
diff
changeset
|
993 make_lisp_hash_table (50, HASH_TABLE_VALUE_WEAK, Qeq); |
2168 | 994 FRAME_GTK_WIDGET_CALLBACK_HASH_TABLE (f) = |
5191
71ee43b8a74d
Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents:
5178
diff
changeset
|
995 make_lisp_hash_table (50, HASH_TABLE_VALUE_WEAK, Qeq); |
2168 | 996 FRAME_GTK_WIDGET_CALLBACK_EX_HASH_TABLE (f) = |
5191
71ee43b8a74d
Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents:
5178
diff
changeset
|
997 make_lisp_hash_table (50, HASH_TABLE_VALUE_WEAK, Qeq); |
462 | 998 } |
999 | |
1000 | |
1001 /************************************************************************/ | |
1002 /* Lisp functions */ | |
1003 /************************************************************************/ | |
1004 | |
1005 static void | |
771 | 1006 gtk_init_frame_1 (struct frame *f, Lisp_Object props, |
2286 | 1007 int UNUSED (frame_name_is_defaulted)) |
462 | 1008 { |
1009 /* This function can GC */ | |
1010 Lisp_Object initially_unmapped; | |
1011 Lisp_Object device = FRAME_DEVICE (f); | |
1012 Lisp_Object lisp_window_id = Fplist_get (props, Qwindow_id, Qnil); | |
1013 Lisp_Object popup = Fplist_get (props, Qpopup, Qnil); | |
1014 | |
1015 if (!NILP (popup)) | |
1016 { | |
1017 if (EQ (popup, Qt)) | |
1018 popup = Fselected_frame (device); | |
1019 CHECK_LIVE_FRAME (popup); | |
1020 if (!EQ (device, FRAME_DEVICE (XFRAME (popup)))) | |
563 | 1021 invalid_argument_2 ("Parent must be on same device as frame", |
1022 device, popup); | |
462 | 1023 } |
1024 | |
1025 initially_unmapped = Fplist_get (props, Qinitially_unmapped, Qnil); | |
1026 | |
1027 /* | |
1028 * Previously we set this only if NILP (DEVICE_SELECTED_FRAME (d)) | |
1029 * to make sure that messages were displayed as soon as possible | |
1030 * if we're creating the first frame on a device. But it is | |
1031 * better to just set this all the time, so that when a new frame | |
1032 * is created that covers the selected frame, echo area status | |
1033 * messages can still be seen. f->visible is reset later if the | |
1034 * initially-unmapped property is found to be non-nil in the | |
1035 * frame properties. | |
1036 */ | |
1037 f->visible = 1; | |
1038 | |
1039 allocate_gtk_frame_struct (f); | |
1040 gtk_create_widgets (f, lisp_window_id, popup); | |
1041 | |
1042 if (!NILP (initially_unmapped)) | |
1043 { | |
1044 gtk_object_set_data (GTK_OBJECT (FRAME_GTK_SHELL_WIDGET (f)), | |
1045 UNMAPPED_DATA_IDENTIFIER, (gpointer) 1); | |
1046 } | |
1047 } | |
1048 | |
1049 static void | |
2286 | 1050 gtk_init_frame_2 (struct frame *f, Lisp_Object UNUSED (props)) |
462 | 1051 { |
1052 /* Set up the values of the widget/frame. A case could be made for putting | |
1053 this inside of the widget's initialize method. */ | |
1054 | |
1055 update_frame_face_values (f); | |
1056 gtk_initialize_frame_size (f); | |
1057 /* Kyle: | |
1058 * update_frame_title() can't be done here, because some of the | |
1059 * modeline specs depend on the frame's device having a selected | |
1060 * frame, and that may not have been set up yet. The redisplay | |
1061 * will update the frame title anyway, so nothing is lost. | |
1062 * JV: | |
1063 * It turns out it gives problems with FVWMs name based mapping. | |
5384
3889ef128488
Fix misspelled words, and some grammar, across the entire source tree.
Jerry James <james@xemacs.org>
parents:
5191
diff
changeset
|
1064 * We'll just need to be careful in the modeline specs. |
462 | 1065 */ |
1066 update_frame_title (f); | |
1067 } | |
1068 | |
1069 static void | |
1070 gtk_init_frame_3 (struct frame *f) | |
1071 { | |
1072 /* Pop up the frame. */ | |
1073 gtk_popup_frame (f); | |
1074 } | |
1075 | |
1076 static void | |
1077 gtk_mark_frame (struct frame *f) | |
1078 { | |
1079 mark_object (FRAME_GTK_ICON_PIXMAP (f)); | |
1080 mark_object (FRAME_GTK_ICON_PIXMAP_MASK (f)); | |
1346 | 1081 mark_object (FRAME_GTK_MENUBAR_DATA (f)); |
462 | 1082 mark_object (FRAME_GTK_LISP_WIDGETS (f)[0]); |
1083 mark_object (FRAME_GTK_LISP_WIDGETS (f)[1]); | |
1084 mark_object (FRAME_GTK_LISP_WIDGETS (f)[2]); | |
2168 | 1085 mark_object (FRAME_GTK_WIDGET_INSTANCE_HASH_TABLE (f)); |
1086 mark_object (FRAME_GTK_WIDGET_CALLBACK_HASH_TABLE (f)); | |
1087 mark_object (FRAME_GTK_WIDGET_CALLBACK_EX_HASH_TABLE (f)); | |
462 | 1088 } |
1089 | |
1090 static void | |
1091 gtk_set_frame_icon (struct frame *f) | |
1092 { | |
1093 GdkPixmap *gtk_pixmap = NULL, *gtk_mask = NULL; | |
1094 | |
1095 if (IMAGE_INSTANCEP (f->icon) | |
1096 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (f->icon))) | |
1097 { | |
1098 gtk_pixmap = XIMAGE_INSTANCE_GTK_PIXMAP (f->icon); | |
1099 gtk_mask = XIMAGE_INSTANCE_GTK_MASK (f->icon); | |
1100 } | |
1101 else | |
1102 { | |
1103 gtk_pixmap = 0; | |
1104 gtk_mask = 0; | |
1105 } | |
1106 | |
1107 gdk_window_set_icon (GET_GTK_WIDGET_WINDOW (FRAME_GTK_SHELL_WIDGET (f)), NULL, gtk_pixmap, gtk_mask); | |
1108 } | |
1109 | |
1110 static void | |
1111 gtk_set_frame_pointer (struct frame *f) | |
1112 { | |
1113 GtkWidget *w = FRAME_GTK_TEXT_WIDGET (f); | |
1114 GdkCursor *c = XIMAGE_INSTANCE_GTK_CURSOR (f->pointer); | |
1115 | |
1116 if (POINTER_IMAGE_INSTANCEP (f->pointer)) | |
1117 { | |
1118 gdk_window_set_cursor (GET_GTK_WIDGET_WINDOW (w), c); | |
1119 gdk_flush (); | |
1120 } | |
1121 else | |
1122 { | |
2500 | 1123 /* ABORT()? */ |
462 | 1124 stderr_out ("POINTER_IMAGE_INSTANCEP (f->pointer) failed!\n"); |
1125 } | |
1126 } | |
1127 | |
1128 static Lisp_Object | |
1129 gtk_get_frame_parent (struct frame *f) | |
1130 { | |
2054 | 1131 GtkWidget *parentwid = (GtkWidget*) gtk_object_get_data (GTK_OBJECT (FRAME_GTK_SHELL_WIDGET (f)), |
1132 TRANSIENT_DATA_IDENTIFIER); | |
462 | 1133 |
1134 /* find the frame whose wid is parentwid */ | |
1135 if (parentwid) | |
1136 { | |
1137 Lisp_Object frmcons; | |
1138 DEVICE_FRAME_LOOP (frmcons, XDEVICE (FRAME_DEVICE (f))) | |
1139 { | |
1140 Lisp_Object frame = XCAR (frmcons); | |
1141 if (FRAME_GTK_SHELL_WIDGET (XFRAME (frame)) == parentwid) | |
1142 return frame; | |
1143 } | |
1144 } | |
1145 return Qnil; | |
1146 } | |
1147 | |
1148 #ifdef STUPID_X_SPECIFIC_GTK_STUFF | |
1149 DEFUN ("gtk-window-id", Fgtk_window_id, 0, 1, 0, /* | |
1150 Get the ID of the Gtk window. | |
1151 This gives us a chance to manipulate the Emacs window from within a | |
1152 different program. Since the ID is an unsigned long, we return it as | |
1153 a string. | |
1154 */ | |
1155 (frame)) | |
1156 { | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4117
diff
changeset
|
1157 Ascbyte str[255]; |
462 | 1158 struct frame *f = decode_gtk_frame (frame); |
1159 | |
1160 /* Arrrrggghhh... this defeats the whole purpose of using Gdk... do we really need this? */ | |
1161 sprintf (str, "%lu", GDK_WINDOW_XWINDOW( GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f)))); | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4117
diff
changeset
|
1162 return build_ascstring (str); |
462 | 1163 } |
1164 #endif | |
1165 | |
1166 | |
1167 /************************************************************************/ | |
1168 /* manipulating the X window */ | |
1169 /************************************************************************/ | |
1170 | |
1171 static void | |
1172 gtk_set_frame_position (struct frame *f, int xoff, int yoff) | |
1173 { | |
1174 gtk_widget_set_uposition (FRAME_GTK_SHELL_WIDGET (f), xoff, yoff); | |
1175 } | |
1176 | |
1177 /* Call this to change the size of frame S's x-window. */ | |
1178 | |
1179 static void | |
1180 gtk_set_frame_size (struct frame *f, int cols, int rows) | |
1181 { | |
1182 GtkWidget *shell = FRAME_GTK_SHELL_WIDGET (f); | |
1183 GdkGeometry geometry; | |
1184 | |
1185 if (GTK_IS_WINDOW (shell)) | |
1186 { | |
2054 | 1187 GdkWindowHints geometry_mask = GDK_HINT_RESIZE_INC; |
1188 | |
462 | 1189 /* Update the cell size */ |
5047
07dcc7000bbf
put width before height consistently, fix a real bug found in the process
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
1190 default_face_width_and_height (wrap_frame (f), &geometry.width_inc, |
07dcc7000bbf
put width before height consistently, fix a real bug found in the process
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
1191 &geometry.height_inc); |
462 | 1192 |
1193 gtk_window_set_geometry_hints (GTK_WINDOW (shell), | |
1194 FRAME_GTK_TEXT_WIDGET (f), &geometry, geometry_mask); | |
1195 } | |
1196 | |
5043 | 1197 change_frame_size (f, cols, rows, 0); |
462 | 1198 |
1199 { | |
1200 GtkRequisition req; | |
1201 | |
1202 gtk_widget_size_request (FRAME_GTK_SHELL_WIDGET (f), &req); | |
1203 gtk_widget_set_usize (FRAME_GTK_SHELL_WIDGET (f), req.width, req.height); | |
1204 } | |
1205 } | |
1206 | |
1207 #ifdef STUPID_X_SPECIFIC_GTK_STUFF | |
1208 /* There is NO equivalent to XWarpPointer under Gtk */ | |
1209 static void | |
1210 gtk_set_mouse_position (struct window *w, int x, int y) | |
1211 { | |
1212 struct frame *f = XFRAME (w->frame); | |
1213 Display *display = GDK_DISPLAY (); | |
1214 XWarpPointer (display, None, | |
1215 GDK_WINDOW_XWINDOW (GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f))), | |
1216 0, 0, 0, 0, w->pixel_left + x, w->pixel_top + y); | |
1217 } | |
1218 #endif /* STUPID_X_SPECIFIC_GTK_STUFF */ | |
1219 | |
1220 static int | |
1221 gtk_get_mouse_position (struct device *d, Lisp_Object *frame, int *x, int *y) | |
1222 { | |
1223 /* Returns the pixel position within the editor text widget */ | |
1224 gint win_x, win_y; | |
1225 GdkWindow *w = gdk_window_at_pointer (&win_x, &win_y); | |
1226 struct frame *f = NULL; | |
1227 | |
1228 if (!w) return (0); | |
1229 | |
1230 /* At this point, w is the innermost GdkWindow containing the | |
1231 ** pointer and win_x and win_y are the coordinates of that window. | |
1232 */ | |
1233 f = gtk_any_window_to_frame (d, w); | |
1234 | |
1235 if (!f) return (0); | |
1236 | |
793 | 1237 *frame = wrap_frame (f); |
462 | 1238 |
1239 gdk_window_get_pointer (GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f)), | |
1240 &win_x, &win_y, NULL); | |
1241 | |
1242 *x = win_x; | |
1243 *y = win_y; | |
1244 | |
1245 return (1); | |
1246 } | |
1247 | |
2268 | 1248 static DECLARE_DOESNT_RETURN (gtk_cant_notify_wm_error (void)); |
1249 | |
1250 static DOESNT_RETURN | |
1251 gtk_cant_notify_wm_error () | |
462 | 1252 { |
563 | 1253 signal_error (Qgui_error, "Can't notify window manager of iconification", Qunbound); |
462 | 1254 } |
1255 | |
1256 /* Raise frame F. */ | |
1257 static void | |
1258 gtk_raise_frame_1 (struct frame *f, int force) | |
1259 { | |
1260 if (FRAME_VISIBLE_P (f) || force) | |
1261 { | |
1262 GdkWindow *emacs_window = GET_GTK_WIDGET_WINDOW (FRAME_GTK_SHELL_WIDGET (f)); | |
1263 | |
1264 gdk_window_raise (emacs_window); | |
1265 } | |
1266 } | |
1267 | |
1268 static void | |
1269 gtk_raise_frame (struct frame *f) | |
1270 { | |
1271 gtk_raise_frame_1 (f, 1); | |
1272 } | |
1273 | |
1274 /* Lower frame F. */ | |
1275 static void | |
1276 gtk_lower_frame (struct frame *f) | |
1277 { | |
1278 if (FRAME_VISIBLE_P (f)) | |
1279 { | |
1280 gdk_window_lower (GET_GTK_WIDGET_WINDOW (FRAME_GTK_SHELL_WIDGET (f))); | |
1281 } | |
1282 } | |
1283 | |
1284 /* Change from withdrawn state to mapped state. */ | |
1285 static void | |
1286 gtk_make_frame_visible (struct frame *f) | |
1287 { | |
2195 | 1288 gtk_widget_map (FRAME_GTK_SHELL_WIDGET (f)); |
462 | 1289 gtk_raise_frame_1 (f, 0); |
1290 } | |
1291 | |
1292 /* Change from mapped state to withdrawn state. */ | |
1293 static void | |
1294 gtk_make_frame_invisible (struct frame *f) | |
1295 { | |
2195 | 1296 gtk_widget_unmap(FRAME_GTK_SHELL_WIDGET (f)); |
462 | 1297 } |
1298 | |
1299 static int | |
1300 gtk_frame_visible_p (struct frame *f) | |
1301 { | |
1302 GtkWidget *w = FRAME_GTK_SHELL_WIDGET (f); | |
1303 | |
1304 f->visible = (GTK_OBJECT_FLAGS (w) & GTK_VISIBLE); | |
1305 | |
1306 return f->visible; | |
1307 } | |
1308 | |
1309 static int | |
1310 gtk_frame_totally_visible_p (struct frame *f) | |
1311 { | |
1312 return FRAME_GTK_TOTALLY_VISIBLE_P (f); | |
1313 } | |
1314 | |
1315 /* Change window state from mapped to iconified. */ | |
1316 static void | |
1317 gtk_iconify_frame (struct frame *f) | |
1318 { | |
1319 GdkWindow *w = GET_GTK_WIDGET_WINDOW (FRAME_GTK_SHELL_WIDGET (f)); | |
1320 | |
1321 /* There is no equivalent to XIconifyWindow in Gtk/Gdk. */ | |
1322 if (!XIconifyWindow (GDK_WINDOW_XDISPLAY (w), | |
1323 GDK_WINDOW_XWINDOW (w), | |
1324 DefaultScreen (GDK_WINDOW_XDISPLAY (w)))) | |
1325 gtk_cant_notify_wm_error (); | |
1326 | |
1327 f->iconified = 1; | |
1328 } | |
1329 | |
1330 /* Sets the X focus to frame f. */ | |
1331 static void | |
1332 gtk_focus_on_frame (struct frame *f) | |
1333 { | |
1334 GtkWidget *shell_widget; | |
1335 | |
1336 assert (FRAME_GTK_P (f)); | |
1337 | |
1338 shell_widget = FRAME_GTK_SHELL_WIDGET (f); | |
1339 if (!GET_GTK_WIDGET_WINDOW (shell_widget)) | |
1340 return; | |
1341 | |
1342 gtk_widget_grab_focus (shell_widget); | |
1343 } | |
1344 | |
1345 /* Destroy the window of frame S. */ | |
1346 static void | |
1347 gtk_delete_frame (struct frame *f) | |
1348 { | |
1349 GtkWidget *w = FRAME_GTK_SHELL_WIDGET (f); | |
1350 | |
1351 gtk_widget_destroy (w); | |
1352 | |
1353 if (FRAME_GTK_GEOM_FREE_ME_PLEASE (f)) | |
4976
16112448d484
Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents:
4962
diff
changeset
|
1354 xfree (FRAME_GTK_GEOM_FREE_ME_PLEASE (f)); |
4117 | 1355 #ifndef NEW_GC |
4976
16112448d484
Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents:
4962
diff
changeset
|
1356 xfree (f->frame_data); |
3092 | 1357 #endif /* not NEW_GC */ |
462 | 1358 f->frame_data = 0; |
1359 } | |
1360 | |
1361 static void | |
1362 gtk_recompute_cell_sizes (struct frame *frm) | |
1363 { | |
1364 if (GTK_IS_WINDOW (FRAME_GTK_SHELL_WIDGET (frm))) | |
1365 { | |
1366 GtkWindow *w = GTK_WINDOW (FRAME_GTK_SHELL_WIDGET (frm)); | |
1367 GdkGeometry geometry; | |
1368 GdkWindowHints geometry_mask; | |
1369 gint width_inc = 10; | |
1370 gint height_inc = 10; | |
1371 | |
5047
07dcc7000bbf
put width before height consistently, fix a real bug found in the process
Ben Wing <ben@xemacs.org>
parents:
5043
diff
changeset
|
1372 default_face_width_and_height (wrap_frame (frm), &width_inc, &height_inc); |
462 | 1373 geometry_mask = GDK_HINT_RESIZE_INC; |
1374 geometry.width_inc = width_inc; | |
1375 geometry.height_inc = height_inc; | |
1376 | |
1377 gtk_window_set_geometry_hints (w, FRAME_GTK_TEXT_WIDGET (frm), &geometry, geometry_mask); | |
1378 } | |
1379 } | |
1380 | |
1381 static void | |
1382 gtk_update_frame_external_traits (struct frame* frm, Lisp_Object name) | |
1383 { | |
1384 Lisp_Object frame = Qnil; | |
1385 | |
793 | 1386 frame = wrap_frame (frm); |
462 | 1387 |
1388 if (EQ (name, Qforeground)) | |
1389 { | |
1390 Lisp_Object color = FACE_FOREGROUND (Vdefault_face, frame); | |
1391 GdkColor *fgc; | |
1392 | |
1393 if (!EQ (color, Vthe_null_color_instance)) | |
1394 { | |
1395 fgc = COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (color)); | |
1396 /* #### BILL!!! The X code set the XtNforeground property of | |
1397 the text widget here. Why did they bother? All that type | |
1398 of thing is done down in the guts of the redisplay code, | |
1399 not in the Emacs* widgets. */ | |
1400 } | |
1401 } | |
1402 else if (EQ (name, Qbackground)) | |
1403 { | |
1404 Lisp_Object color = FACE_BACKGROUND (Vdefault_face, frame); | |
1405 GdkColor *bgc; | |
1406 | |
1407 if (!EQ (color, Vthe_null_color_instance)) | |
1408 { | |
1409 bgc = COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (color)); | |
1410 if (FRAME_GTK_SHELL_WIDGET (frm)->window) | |
1411 { | |
1412 gdk_window_set_background (FRAME_GTK_SHELL_WIDGET (frm)->window, bgc); | |
1413 } | |
1414 if (FRAME_GTK_TEXT_WIDGET (frm)->window) | |
1415 { | |
1416 gdk_window_set_background (FRAME_GTK_TEXT_WIDGET (frm)->window, bgc); | |
1417 } | |
1418 } | |
1419 | |
1420 /* Really crappy way to force the modeline shadows to be | |
1421 redrawn. But effective. */ | |
1422 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (frm); | |
1423 MARK_FRAME_CHANGED (frm); | |
1424 } | |
1425 else if (EQ (name, Qfont)) | |
1426 { | |
1427 Lisp_Object font = FACE_FONT (Vdefault_face, frame, Vcharset_ascii); | |
1428 | |
3676 | 1429 /* It may be that instantiating the font has deleted the frame (will |
1430 happen if the user has specified a charset registry for ASCII that | |
1431 isn't available on the server, and our fallback of iso8859-1 isn't | |
1432 available; something vanishingly rare.) In that case, return from | |
1433 this function. */ | |
1434 | |
1435 if (!FRAME_LIVE_P(frm)) | |
1436 { | |
1437 return; | |
1438 } | |
1439 | |
462 | 1440 if (!EQ (font, Vthe_null_font_instance)) |
1441 { | |
1442 /* #### BILL!!! The X code set the XtNfont property of the | |
1443 text widget here. Why did they bother? All that type of | |
1444 thing is done down in the guts of the redisplay code, not | |
1445 in the Emacs* widgets. */ | |
1446 } | |
1447 } | |
1448 else | |
2500 | 1449 ABORT (); |
462 | 1450 |
1451 #ifdef HAVE_TOOLBARS | |
1452 /* Setting the background clears the entire frame area | |
1453 including the toolbar so we force an immediate redraw of | |
1454 it. */ | |
1455 if (EQ (name, Qbackground)) | |
1456 MAYBE_DEVMETH (XDEVICE (frm->device), redraw_frame_toolbars, (frm)); | |
1457 #endif /* HAVE_TOOLBARS */ | |
1458 | |
1459 /* Set window manager resize increment hints according to | |
1460 the new character size */ | |
1461 if (EQ (name, Qfont) && FRAME_GTK_TOP_LEVEL_FRAME_P (frm)) | |
1462 gtk_recompute_cell_sizes (frm); | |
1463 } | |
1464 | |
1465 | |
1466 /************************************************************************/ | |
1467 /* initialization */ | |
1468 /************************************************************************/ | |
1469 | |
1470 void | |
1471 syms_of_frame_gtk (void) | |
1472 { | |
3092 | 1473 #ifdef NEW_GC |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4117
diff
changeset
|
1474 INIT_LISP_OBJECT (gtk_frame); |
3092 | 1475 #endif /* NEW_GC */ |
1476 | |
563 | 1477 DEFSYMBOL (Qtext_widget); |
1478 DEFSYMBOL (Qcontainer_widget); | |
1479 DEFSYMBOL (Qshell_widget); | |
1480 DEFSYMBOL (Qdetachable_menubar); | |
462 | 1481 |
1482 #ifdef HAVE_DRAGNDROP | |
1483 staticpro (&Vcurrent_drag_object); | |
1484 Vcurrent_drag_object = Qnil; | |
1485 DEFSUBR (Fgtk_start_drag_internal); | |
1486 #endif | |
1487 #ifdef STUPID_X_SPECIFIC_GTK_STUFF | |
1488 DEFSUBR (Fgtk_window_id); | |
1489 #endif | |
1490 } | |
1491 | |
1492 void | |
1493 console_type_create_frame_gtk (void) | |
1494 { | |
1495 /* frame methods */ | |
1496 CONSOLE_HAS_METHOD (gtk, init_frame_1); | |
1497 CONSOLE_HAS_METHOD (gtk, init_frame_2); | |
1498 CONSOLE_HAS_METHOD (gtk, init_frame_3); | |
1499 CONSOLE_HAS_METHOD (gtk, mark_frame); | |
1500 CONSOLE_HAS_METHOD (gtk, focus_on_frame); | |
1501 CONSOLE_HAS_METHOD (gtk, delete_frame); | |
1502 CONSOLE_HAS_METHOD (gtk, get_mouse_position); | |
1503 #ifdef STUPID_X_SPECIFIC_GTK_STUFF | |
1504 CONSOLE_HAS_METHOD (gtk, set_mouse_position); | |
1505 #endif | |
1506 CONSOLE_HAS_METHOD (gtk, raise_frame); | |
1507 CONSOLE_HAS_METHOD (gtk, lower_frame); | |
1508 CONSOLE_HAS_METHOD (gtk, make_frame_visible); | |
1509 CONSOLE_HAS_METHOD (gtk, make_frame_invisible); | |
1510 CONSOLE_HAS_METHOD (gtk, iconify_frame); | |
1511 CONSOLE_HAS_METHOD (gtk, set_frame_size); | |
1512 CONSOLE_HAS_METHOD (gtk, set_frame_position); | |
1513 CONSOLE_HAS_METHOD (gtk, frame_property); | |
1514 CONSOLE_HAS_METHOD (gtk, internal_frame_property_p); | |
1515 CONSOLE_HAS_METHOD (gtk, frame_properties); | |
1516 CONSOLE_HAS_METHOD (gtk, set_frame_properties); | |
867 | 1517 CONSOLE_HAS_METHOD (gtk, set_title_from_ibyte); |
1518 CONSOLE_HAS_METHOD (gtk, set_icon_name_from_ibyte); | |
462 | 1519 CONSOLE_HAS_METHOD (gtk, frame_visible_p); |
1520 CONSOLE_HAS_METHOD (gtk, frame_totally_visible_p); | |
1521 CONSOLE_HAS_METHOD (gtk, frame_iconified_p); | |
1522 CONSOLE_HAS_METHOD (gtk, set_frame_pointer); | |
1523 CONSOLE_HAS_METHOD (gtk, set_frame_icon); | |
1524 CONSOLE_HAS_METHOD (gtk, get_frame_parent); | |
1525 CONSOLE_HAS_METHOD (gtk, update_frame_external_traits); | |
1526 } | |
1527 | |
1528 void | |
1529 vars_of_frame_gtk (void) | |
1530 { | |
1531 DEFVAR_LISP ("default-gtk-frame-plist", &Vdefault_gtk_frame_plist /* | |
1532 Plist of default frame-creation properties for Gtk frames. | |
1533 These override what is specified in the resource database and in | |
1534 `default-frame-plist', but are overridden by the arguments to the | |
1535 particular call to `make-frame'. | |
1536 | |
1537 Note: In many cases, properties of a frame are available as specifiers | |
1538 instead of through the frame-properties mechanism. | |
1539 | |
1540 Here is a list of recognized frame properties, other than those | |
1541 documented in `set-frame-properties' (they can be queried and | |
1542 set at any time, except as otherwise noted): | |
1543 | |
1544 initially-unmapped If non-nil, the frame will not be visible | |
1545 when it is created. In this case, you | |
1546 need to call `make-frame-visible' to make | |
1547 the frame appear. | |
1548 popup If non-nil, it should be a frame, and this | |
1549 frame will be created as a "popup" frame | |
1550 whose parent is the given frame. This | |
1551 will make the window manager treat the | |
1552 frame as a dialog box, which may entail | |
1553 doing different things (e.g. not asking | |
1554 for positioning, and not iconifying | |
1555 separate from its parent). | |
1556 inter-line-space Not currently implemented. | |
1557 toolbar-shadow-thickness Thickness of toolbar shadows. | |
1558 background-toolbar-color Color of toolbar background. | |
1559 bottom-toolbar-shadow-color Color of bottom shadows on toolbars. | |
1560 (*Not* specific to the bottom-toolbar.) | |
1561 top-toolbar-shadow-color Color of top shadows on toolbars. | |
1562 (*Not* specific to the top-toolbar.) | |
1563 internal-border-width Width of internal border around text area. | |
1564 border-width Width of external border around text area. | |
1565 top Y position (in pixels) of the upper-left | |
1566 outermost corner of the frame (i.e. the | |
1567 upper-left of the window-manager | |
1568 decorations). | |
1569 left X position (in pixels) of the upper-left | |
1570 outermost corner of the frame (i.e. the | |
1571 upper-left of the window-manager | |
1572 decorations). | |
1573 border-color Color of external border around text area. | |
1574 cursor-color Color of text cursor. | |
1575 | |
1576 See also `default-frame-plist', which specifies properties which apply | |
1577 to all frames, not just Gtk frames. | |
1578 */ ); | |
1579 Vdefault_gtk_frame_plist = Qnil; | |
1580 | |
1581 gtk_console_methods->device_specific_frame_props = &Vdefault_gtk_frame_plist; | |
1582 } |