annotate src/frame-gtk.c @ 4981:4aebb0131297

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