Mercurial > hg > xemacs-beta
annotate src/device-gtk.c @ 5127:a9c41067dd88 ben-lisp-object
more cleanups, terminology clarification, lots of doc work
-------------------- ChangeLog entries follow: --------------------
man/ChangeLog addition:
2010-03-05 Ben Wing <ben@xemacs.org>
* internals/internals.texi (Introduction to Allocation):
* internals/internals.texi (Integers and Characters):
* internals/internals.texi (Allocation from Frob Blocks):
* internals/internals.texi (lrecords):
* internals/internals.texi (Low-level allocation):
Rewrite section on allocation of Lisp objects to reflect the new
reality. Remove references to nonexistent XSETINT and XSETCHAR.
modules/ChangeLog addition:
2010-03-05 Ben Wing <ben@xemacs.org>
* postgresql/postgresql.c (allocate_pgconn):
* postgresql/postgresql.c (allocate_pgresult):
* postgresql/postgresql.h (struct Lisp_PGconn):
* postgresql/postgresql.h (struct Lisp_PGresult):
* ldap/eldap.c (allocate_ldap):
* ldap/eldap.h (struct Lisp_LDAP):
Same changes as in src/ dir. See large log there in ChangeLog,
but basically:
ALLOC_LISP_OBJECT -> ALLOC_NORMAL_LISP_OBJECT
LISP_OBJECT_HEADER -> NORMAL_LISP_OBJECT_HEADER
../hlo/src/ChangeLog addition:
2010-03-05 Ben Wing <ben@xemacs.org>
* alloc.c:
* alloc.c (old_alloc_sized_lcrecord):
* alloc.c (very_old_free_lcrecord):
* alloc.c (copy_lisp_object):
* alloc.c (zero_sized_lisp_object):
* alloc.c (zero_nonsized_lisp_object):
* alloc.c (lisp_object_storage_size):
* alloc.c (free_normal_lisp_object):
* alloc.c (FREE_FIXED_TYPE_WHEN_NOT_IN_GC):
* alloc.c (ALLOC_FROB_BLOCK_LISP_OBJECT):
* alloc.c (Fcons):
* alloc.c (noseeum_cons):
* alloc.c (make_float):
* alloc.c (make_bignum):
* alloc.c (make_bignum_bg):
* alloc.c (make_ratio):
* alloc.c (make_ratio_bg):
* alloc.c (make_ratio_rt):
* alloc.c (make_bigfloat):
* alloc.c (make_bigfloat_bf):
* alloc.c (size_vector):
* alloc.c (make_compiled_function):
* alloc.c (Fmake_symbol):
* alloc.c (allocate_extent):
* alloc.c (allocate_event):
* alloc.c (make_key_data):
* alloc.c (make_button_data):
* alloc.c (make_motion_data):
* alloc.c (make_process_data):
* alloc.c (make_timeout_data):
* alloc.c (make_magic_data):
* alloc.c (make_magic_eval_data):
* alloc.c (make_eval_data):
* alloc.c (make_misc_user_data):
* alloc.c (Fmake_marker):
* alloc.c (noseeum_make_marker):
* alloc.c (size_string_direct_data):
* alloc.c (make_uninit_string):
* alloc.c (make_string_nocopy):
* alloc.c (mark_lcrecord_list):
* alloc.c (alloc_managed_lcrecord):
* alloc.c (free_managed_lcrecord):
* alloc.c (sweep_lcrecords_1):
* alloc.c (malloced_storage_size):
* buffer.c (allocate_buffer):
* buffer.c (compute_buffer_usage):
* buffer.c (DEFVAR_BUFFER_LOCAL_1):
* buffer.c (nuke_all_buffer_slots):
* buffer.c (common_init_complex_vars_of_buffer):
* buffer.h (struct buffer_text):
* buffer.h (struct buffer):
* bytecode.c:
* bytecode.c (make_compiled_function_args):
* bytecode.c (size_compiled_function_args):
* bytecode.h (struct compiled_function_args):
* casetab.c (allocate_case_table):
* casetab.h (struct Lisp_Case_Table):
* charset.h (struct Lisp_Charset):
* chartab.c (fill_char_table):
* chartab.c (Fmake_char_table):
* chartab.c (make_char_table_entry):
* chartab.c (copy_char_table_entry):
* chartab.c (Fcopy_char_table):
* chartab.c (put_char_table):
* chartab.h (struct Lisp_Char_Table_Entry):
* chartab.h (struct Lisp_Char_Table):
* console-gtk-impl.h (struct gtk_device):
* console-gtk-impl.h (struct gtk_frame):
* console-impl.h (struct console):
* console-msw-impl.h (struct Lisp_Devmode):
* console-msw-impl.h (struct mswindows_device):
* console-msw-impl.h (struct msprinter_device):
* console-msw-impl.h (struct mswindows_frame):
* console-msw-impl.h (struct mswindows_dialog_id):
* console-stream-impl.h (struct stream_console):
* console-stream.c (stream_init_console):
* console-tty-impl.h (struct tty_console):
* console-tty-impl.h (struct tty_device):
* console-tty.c (allocate_tty_console_struct):
* console-x-impl.h (struct x_device):
* console-x-impl.h (struct x_frame):
* console.c (allocate_console):
* console.c (nuke_all_console_slots):
* console.c (DEFVAR_CONSOLE_LOCAL_1):
* console.c (common_init_complex_vars_of_console):
* data.c (make_weak_list):
* data.c (make_weak_box):
* data.c (make_ephemeron):
* database.c:
* database.c (struct Lisp_Database):
* database.c (allocate_database):
* database.c (finalize_database):
* device-gtk.c (allocate_gtk_device_struct):
* device-impl.h (struct device):
* device-msw.c:
* device-msw.c (mswindows_init_device):
* device-msw.c (msprinter_init_device):
* device-msw.c (finalize_devmode):
* device-msw.c (allocate_devmode):
* device-tty.c (allocate_tty_device_struct):
* device-x.c (allocate_x_device_struct):
* device.c:
* device.c (nuke_all_device_slots):
* device.c (allocate_device):
* dialog-msw.c (handle_question_dialog_box):
* elhash.c:
* elhash.c (struct Lisp_Hash_Table):
* elhash.c (finalize_hash_table):
* elhash.c (make_general_lisp_hash_table):
* elhash.c (Fcopy_hash_table):
* elhash.h (htentry):
* emacs.c (main_1):
* eval.c:
* eval.c (size_multiple_value):
* event-stream.c (finalize_command_builder):
* event-stream.c (allocate_command_builder):
* event-stream.c (free_command_builder):
* event-stream.c (event_stream_generate_wakeup):
* event-stream.c (event_stream_resignal_wakeup):
* event-stream.c (event_stream_disable_wakeup):
* event-stream.c (event_stream_wakeup_pending_p):
* events.h (struct Lisp_Timeout):
* events.h (struct command_builder):
* extents-impl.h:
* extents-impl.h (struct extent_auxiliary):
* extents-impl.h (struct extent_info):
* extents-impl.h (set_extent_no_chase_aux_field):
* extents-impl.h (set_extent_no_chase_normal_field):
* extents.c:
* extents.c (gap_array_marker):
* extents.c (gap_array):
* extents.c (extent_list_marker):
* extents.c (extent_list):
* extents.c (stack_of_extents):
* extents.c (gap_array_make_marker):
* extents.c (extent_list_make_marker):
* extents.c (allocate_extent_list):
* extents.c (SLOT):
* extents.c (mark_extent_auxiliary):
* extents.c (allocate_extent_auxiliary):
* extents.c (attach_extent_auxiliary):
* extents.c (size_gap_array):
* extents.c (finalize_extent_info):
* extents.c (allocate_extent_info):
* extents.c (uninit_buffer_extents):
* extents.c (allocate_soe):
* extents.c (copy_extent):
* extents.c (vars_of_extents):
* extents.h:
* faces.c (allocate_face):
* faces.h (struct Lisp_Face):
* faces.h (struct face_cachel):
* file-coding.c:
* file-coding.c (finalize_coding_system):
* file-coding.c (sizeof_coding_system):
* file-coding.c (Fcopy_coding_system):
* file-coding.h (struct Lisp_Coding_System):
* file-coding.h (MARKED_SLOT):
* fns.c (size_bit_vector):
* font-mgr.c:
* font-mgr.c (finalize_fc_pattern):
* font-mgr.c (print_fc_pattern):
* font-mgr.c (Ffc_pattern_p):
* font-mgr.c (Ffc_pattern_create):
* font-mgr.c (Ffc_name_parse):
* font-mgr.c (Ffc_name_unparse):
* font-mgr.c (Ffc_pattern_duplicate):
* font-mgr.c (Ffc_pattern_add):
* font-mgr.c (Ffc_pattern_del):
* font-mgr.c (Ffc_pattern_get):
* font-mgr.c (fc_config_create_using):
* font-mgr.c (fc_strlist_to_lisp_using):
* font-mgr.c (fontset_to_list):
* font-mgr.c (Ffc_config_p):
* font-mgr.c (Ffc_config_up_to_date):
* font-mgr.c (Ffc_config_build_fonts):
* font-mgr.c (Ffc_config_get_cache):
* font-mgr.c (Ffc_config_get_fonts):
* font-mgr.c (Ffc_config_set_current):
* font-mgr.c (Ffc_config_get_blanks):
* font-mgr.c (Ffc_config_get_rescan_interval):
* font-mgr.c (Ffc_config_set_rescan_interval):
* font-mgr.c (Ffc_config_app_font_add_file):
* font-mgr.c (Ffc_config_app_font_add_dir):
* font-mgr.c (Ffc_config_app_font_clear):
* font-mgr.c (size):
* font-mgr.c (Ffc_config_substitute):
* font-mgr.c (Ffc_font_render_prepare):
* font-mgr.c (Ffc_font_match):
* font-mgr.c (Ffc_font_sort):
* font-mgr.c (finalize_fc_config):
* font-mgr.c (print_fc_config):
* font-mgr.h:
* font-mgr.h (struct fc_pattern):
* font-mgr.h (XFC_PATTERN):
* font-mgr.h (struct fc_config):
* font-mgr.h (XFC_CONFIG):
* frame-gtk.c (allocate_gtk_frame_struct):
* frame-impl.h (struct frame):
* frame-msw.c (mswindows_init_frame_1):
* frame-x.c (allocate_x_frame_struct):
* frame.c (nuke_all_frame_slots):
* frame.c (allocate_frame_core):
* gc.c:
* gc.c (GC_CHECK_NOT_FREE):
* glyphs.c (finalize_image_instance):
* glyphs.c (allocate_image_instance):
* glyphs.c (Fcolorize_image_instance):
* glyphs.c (allocate_glyph):
* glyphs.c (unmap_subwindow_instance_cache_mapper):
* glyphs.c (register_ignored_expose):
* glyphs.h (struct Lisp_Image_Instance):
* glyphs.h (struct Lisp_Glyph):
* glyphs.h (struct glyph_cachel):
* glyphs.h (struct expose_ignore):
* gui.c (allocate_gui_item):
* gui.h (struct Lisp_Gui_Item):
* keymap.c (struct Lisp_Keymap):
* keymap.c (make_keymap):
* lisp.h:
* lisp.h (struct Lisp_String_Direct_Data):
* lisp.h (struct Lisp_String_Indirect_Data):
* lisp.h (struct Lisp_Vector):
* lisp.h (struct Lisp_Bit_Vector):
* lisp.h (DECLARE_INLINE_LISP_BIT_VECTOR):
* lisp.h (struct weak_box):
* lisp.h (struct ephemeron):
* lisp.h (struct weak_list):
* lrecord.h:
* lrecord.h (struct lrecord_implementation):
* lrecord.h (MC_ALLOC_CALL_FINALIZER):
* lrecord.h (struct lcrecord_list):
* lstream.c (finalize_lstream):
* lstream.c (sizeof_lstream):
* lstream.c (Lstream_new):
* lstream.c (Lstream_delete):
* lstream.h (struct lstream):
* marker.c:
* marker.c (finalize_marker):
* marker.c (compute_buffer_marker_usage):
* mule-charset.c:
* mule-charset.c (make_charset):
* mule-charset.c (compute_charset_usage):
* objects-impl.h (struct Lisp_Color_Instance):
* objects-impl.h (struct Lisp_Font_Instance):
* objects-tty-impl.h (struct tty_color_instance_data):
* objects-tty-impl.h (struct tty_font_instance_data):
* objects-tty.c (tty_initialize_color_instance):
* objects-tty.c (tty_initialize_font_instance):
* objects.c (finalize_color_instance):
* objects.c (Fmake_color_instance):
* objects.c (finalize_font_instance):
* objects.c (Fmake_font_instance):
* objects.c (reinit_vars_of_objects):
* opaque.c:
* opaque.c (sizeof_opaque):
* opaque.c (make_opaque_ptr):
* opaque.c (free_opaque_ptr):
* opaque.h:
* opaque.h (Lisp_Opaque):
* opaque.h (Lisp_Opaque_Ptr):
* print.c (printing_unreadable_lcrecord):
* print.c (external_object_printer):
* print.c (debug_p4):
* process.c (finalize_process):
* process.c (make_process_internal):
* procimpl.h (struct Lisp_Process):
* rangetab.c (Fmake_range_table):
* rangetab.c (Fcopy_range_table):
* rangetab.h (struct Lisp_Range_Table):
* scrollbar.c:
* scrollbar.c (create_scrollbar_instance):
* scrollbar.c (compute_scrollbar_instance_usage):
* scrollbar.h (struct scrollbar_instance):
* specifier.c (finalize_specifier):
* specifier.c (sizeof_specifier):
* specifier.c (set_specifier_caching):
* specifier.h (struct Lisp_Specifier):
* specifier.h (struct specifier_caching):
* symeval.h:
* symeval.h (SYMBOL_VALUE_MAGIC_P):
* symeval.h (DEFVAR_SYMVAL_FWD):
* symsinit.h:
* syntax.c (init_buffer_syntax_cache):
* syntax.h (struct syntax_cache):
* toolbar.c:
* toolbar.c (allocate_toolbar_button):
* toolbar.c (update_toolbar_button):
* toolbar.h (struct toolbar_button):
* tooltalk.c (struct Lisp_Tooltalk_Message):
* tooltalk.c (make_tooltalk_message):
* tooltalk.c (struct Lisp_Tooltalk_Pattern):
* tooltalk.c (make_tooltalk_pattern):
* ui-gtk.c:
* ui-gtk.c (allocate_ffi_data):
* ui-gtk.c (emacs_gtk_object_finalizer):
* ui-gtk.c (allocate_emacs_gtk_object_data):
* ui-gtk.c (allocate_emacs_gtk_boxed_data):
* ui-gtk.h:
* window-impl.h (struct window):
* window-impl.h (struct window_mirror):
* window.c (finalize_window):
* window.c (allocate_window):
* window.c (new_window_mirror):
* window.c (mark_window_as_deleted):
* window.c (make_dummy_parent):
* window.c (compute_window_mirror_usage):
* window.c (compute_window_usage):
Overall point of this change and previous ones in this repository:
(1) Introduce new, clearer terminology: everything other than int
or char is a "record" object, which comes in two types: "normal
objects" and "frob-block objects". Fix up all places that
referred to frob-block objects as "simple", "basic", etc.
(2) Provide an advertised interface for doing operations on Lisp
objects, including creating new types, that is clean and
consistent in its naming, uses the above-referenced terms and
avoids referencing "lrecords", "old lcrecords", etc., which should
hide under the surface.
(3) Make the size_in_bytes and finalizer methods take a
Lisp_Object rather than a void * for consistency with other methods.
(4) Separate finalizer method into finalizer and disksaver, so
that normal finalize methods don't have to worry about disksaving.
Other specifics:
(1) Renaming:
LISP_OBJECT_HEADER -> NORMAL_LISP_OBJECT_HEADER
ALLOC_LISP_OBJECT -> ALLOC_NORMAL_LISP_OBJECT
implementation->basic_p -> implementation->frob_block_p
ALLOCATE_FIXED_TYPE_AND_SET_IMPL -> ALLOC_FROB_BLOCK_LISP_OBJECT
*FCCONFIG*, wrap_fcconfig -> *FC_CONFIG*, wrap_fc_config
*FCPATTERN*, wrap_fcpattern -> *FC_PATTERN*, wrap_fc_pattern
(the last two changes make the naming of these macros consistent
with the naming of all other macros, since the objects are named
fc-config and fc-pattern with a hyphen)
(2) Lots of documentation fixes in lrecord.h.
(3) Eliminate macros for copying, freeing, zeroing objects, getting
their storage size. Instead, new functions:
zero_sized_lisp_object()
zero_nonsized_lisp_object()
lisp_object_storage_size()
free_normal_lisp_object()
(copy_lisp_object() already exists)
LISP_OBJECT_FROB_BLOCK_P() (actually a macro)
Eliminated:
free_lrecord()
zero_lrecord()
copy_lrecord()
copy_sized_lrecord()
old_copy_lcrecord()
old_copy_sized_lcrecord()
old_zero_lcrecord()
old_zero_sized_lcrecord()
LISP_OBJECT_STORAGE_SIZE()
COPY_SIZED_LISP_OBJECT()
COPY_SIZED_LCRECORD()
COPY_LISP_OBJECT()
ZERO_LISP_OBJECT()
FREE_LISP_OBJECT()
(4) Catch the remaining places where lrecord stuff was used directly
and use the advertised interface, e.g. alloc_sized_lrecord() ->
ALLOC_SIZED_LISP_OBJECT().
(5) Make certain statically-declared pseudo-objects
(buffer_local_flags, console_local_flags) have their lheader
initialized correctly, so things like copy_lisp_object() can work
on them. Make extent_auxiliary_defaults a proper heap object
Vextent_auxiliary_defaults, and make extent auxiliaries dumpable
so that this object can be dumped. allocate_extent_auxiliary()
now just creates the object, and attach_extent_auxiliary()
creates an extent auxiliary and attaches to an extent, like the
old allocate_extent_auxiliary().
(6) Create EXTENT_AUXILIARY_SLOTS macro, similar to the foo-slots.h
files but in a macro instead of a file. The purpose is to avoid
duplication when iterating over all the slots in an extent auxiliary.
Use it.
(7) In lstream.c, don't zero out object after allocation because
allocation routines take care of this.
(8) In marker.c, fix a mistake in computing marker overhead.
(9) In print.c, clean up printing_unreadable_lcrecord(),
external_object_printer() to avoid lots of ifdef NEW_GC's.
(10) Separate toolbar-button allocation into a separate
allocate_toolbar_button() function for use in the example code
in lrecord.h.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Fri, 05 Mar 2010 04:08:17 -0600 |
parents | b5df3737028a |
children | 97eb4942aec8 |
rev | line source |
---|---|
462 | 1 /* Device functions for X windows. |
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. | |
3 Copyright (C) 1994, 1995 Free Software Foundation, Inc. | |
872 | 4 Copyright (C) 2002 Ben Wing. |
462 | 5 |
6 This file is part of XEmacs. | |
7 | |
8 XEmacs is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
10 Free Software Foundation; either version 2, or (at your option) any | |
11 later version. | |
12 | |
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with XEmacs; see the file COPYING. If not, write to | |
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
21 Boston, MA 02111-1307, USA. */ | |
22 | |
23 /* Synched up with: Not in FSF. */ | |
24 | |
25 /* Original authors: Jamie Zawinski and the FSF */ | |
26 /* Rewritten by Ben Wing and Chuck Thompson. */ | |
27 /* Gtk flavor written by William Perry */ | |
28 | |
29 #include <config.h> | |
30 #include "lisp.h" | |
31 | |
872 | 32 #include "buffer.h" |
33 #include "device-impl.h" | |
34 #include "elhash.h" | |
35 #include "events.h" | |
36 #include "faces.h" | |
37 #include "frame-impl.h" | |
38 #include "redisplay.h" | |
39 #include "sysdep.h" | |
40 #include "window.h" | |
41 | |
42 #include "console-gtk-impl.h" | |
462 | 43 #include "gccache-gtk.h" |
44 #include "glyphs-gtk.h" | |
45 #include "objects-gtk.h" | |
46 #include "gtk-xemacs.h" | |
47 | |
48 #include "sysfile.h" | |
49 #include "systime.h" | |
50 | |
51 #ifdef HAVE_GNOME | |
52 #include <libgnomeui/libgnomeui.h> | |
53 #endif | |
54 | |
55 #ifdef HAVE_BONOBO | |
56 #include <bonobo.h> | |
57 #endif | |
58 | |
4477
e34711681f30
Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents:
4117
diff
changeset
|
59 Lisp_Object Qmake_device_early_gtk_entry_point, |
e34711681f30
Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents:
4117
diff
changeset
|
60 Qmake_device_late_gtk_entry_point; |
462 | 61 |
62 /* The application class of Emacs. */ | |
63 Lisp_Object Vgtk_emacs_application_class; | |
64 | |
65 Lisp_Object Vgtk_initial_argv_list; /* #### ugh! */ | |
66 Lisp_Object Vgtk_initial_geometry; | |
67 | |
2828 | 68 Lisp_Object Qgtk_seen_characters; |
69 | |
462 | 70 static void gtk_device_init_x_specific_cruft (struct device *d); |
71 | |
1204 | 72 static const struct memory_description gtk_device_data_description_1 [] = { |
73 { XD_LISP_OBJECT, offsetof (struct gtk_device, x_keysym_map_hashtable) }, | |
74 { XD_LISP_OBJECT, offsetof (struct gtk_device, WM_COMMAND_frame) }, | |
75 { XD_END } | |
76 }; | |
77 | |
3092 | 78 #ifdef NEW_GC |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4477
diff
changeset
|
79 DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("gtk-device", gtk_device, |
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4477
diff
changeset
|
80 0, gtk_device_data_description_1, |
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4477
diff
changeset
|
81 Lisp_Gtk_Device); |
3092 | 82 #else /* not NEW_GC */ |
1204 | 83 extern const struct sized_memory_description gtk_device_data_description; |
84 | |
85 const struct sized_memory_description gtk_device_data_description = { | |
86 sizeof (struct gtk_device), gtk_device_data_description_1 | |
87 }; | |
3092 | 88 #endif /* not NEW_GC */ |
1204 | 89 |
462 | 90 |
91 /************************************************************************/ | |
92 /* helper functions */ | |
93 /************************************************************************/ | |
94 | |
95 struct device * | |
96 decode_gtk_device (Lisp_Object device) | |
97 { | |
793 | 98 device = wrap_device (decode_device (device)); |
462 | 99 CHECK_GTK_DEVICE (device); |
100 return XDEVICE (device); | |
101 } | |
102 | |
103 | |
104 /************************************************************************/ | |
105 /* initializing a GTK connection */ | |
106 /************************************************************************/ | |
107 extern Lisp_Object | |
108 xemacs_gtk_convert_color(GdkColor *c, GtkWidget *w); | |
109 | |
110 extern Lisp_Object __get_gtk_font_truename (GdkFont *gdk_font, int expandp); | |
111 | |
112 #define convert_font(f) __get_gtk_font_truename (f, 0) | |
113 | |
114 static void | |
115 allocate_gtk_device_struct (struct device *d) | |
116 { | |
3092 | 117 #ifdef NEW_GC |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
118 d->device_data = XGTK_DEVICE (ALLOC_NORMAL_LISP_OBJECT (gtk_device)); |
3092 | 119 #else /* not NEW_GC */ |
462 | 120 d->device_data = xnew_and_zero (struct gtk_device); |
3092 | 121 #endif /* not NEW_GC */ |
462 | 122 DEVICE_GTK_DATA (d)->x_keysym_map_hashtable = Qnil; |
123 } | |
124 | |
125 static void | |
126 gtk_init_device_class (struct device *d) | |
127 { | |
128 if (DEVICE_GTK_DEPTH(d) > 2) | |
129 { | |
130 switch (DEVICE_GTK_VISUAL(d)->type) | |
131 { | |
132 case GDK_VISUAL_STATIC_GRAY: | |
133 case GDK_VISUAL_GRAYSCALE: | |
134 DEVICE_CLASS (d) = Qgrayscale; | |
135 break; | |
136 default: | |
137 DEVICE_CLASS (d) = Qcolor; | |
138 } | |
139 } | |
140 else | |
141 DEVICE_CLASS (d) = Qmono; | |
142 } | |
143 | |
144 #ifdef HAVE_GDK_IMLIB_INIT | |
145 extern void gdk_imlib_init(void); | |
146 #endif | |
147 | |
863 | 148 extern void emacs_gtk_selection_handle (GtkWidget *, |
149 GtkSelectionData *selection_data, | |
150 guint info, | |
151 guint time_stamp, | |
152 gpointer data); | |
153 extern void emacs_gtk_selection_clear_event_handle (GtkWidget *widget, | |
154 GdkEventSelection *event, | |
155 gpointer data); | |
156 extern void emacs_gtk_selection_received (GtkWidget *widget, | |
157 GtkSelectionData *selection_data, | |
158 gpointer user_data); | |
159 | |
462 | 160 #ifdef HAVE_BONOBO |
161 static CORBA_ORB orb; | |
162 #endif | |
163 | |
164 DEFUN ("gtk-init", Fgtk_init, 1, 1, 0, /* | |
165 Initialize the GTK subsystem. | |
166 ARGS is a standard list of command-line arguments. | |
167 | |
168 No effect if called more than once. Called automatically when | |
169 creating the first GTK device. Must be called manually from batch | |
170 mode. | |
171 */ | |
172 (args)) | |
173 { | |
174 int argc; | |
175 char **argv; | |
176 static int done; | |
177 | |
178 if (done) | |
179 { | |
180 return (Qt); | |
181 } | |
182 | |
183 make_argc_argv (args, &argc, &argv); | |
184 | |
185 slow_down_interrupts (); | |
186 #ifdef HAVE_GNOME | |
187 #ifdef INFODOCK | |
188 gnome_init ("InfoDock", EMACS_VERSION, argc, argv); | |
189 #else | |
190 gnome_init ("XEmacs", EMACS_VERSION, argc, argv); | |
191 #endif /* INFODOCK */ | |
192 #else | |
193 gtk_init (&argc, &argv); | |
194 #endif | |
195 | |
196 #ifdef HAVE_BONOBO | |
197 orb = oaf_init (argc, argv); | |
198 | |
199 if (bonobo_init (orb, NULL, NULL) == FALSE) | |
200 { | |
201 g_warning ("Could not initialize bonobo..."); | |
202 } | |
203 | |
204 bonobo_activate (); | |
205 #endif | |
206 | |
207 speed_up_interrupts (); | |
208 | |
209 free_argc_argv (argv); | |
210 return (Qt); | |
211 } | |
212 | |
213 static void | |
2286 | 214 gtk_init_device (struct device *d, Lisp_Object UNUSED (props)) |
462 | 215 { |
216 Lisp_Object display; | |
217 GtkWidget *app_shell = NULL; | |
218 GdkVisual *visual = NULL; | |
219 GdkColormap *cmap = NULL; | |
220 | |
4477
e34711681f30
Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents:
4117
diff
changeset
|
221 /* Run the early elisp side of the GTK device initialization. */ |
e34711681f30
Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents:
4117
diff
changeset
|
222 call0 (Qmake_device_early_gtk_entry_point); |
e34711681f30
Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents:
4117
diff
changeset
|
223 |
462 | 224 /* gtk_init() and even gtk_check_init() are so brain dead that |
225 getting an empty argv array causes them to abort. */ | |
226 if (NILP (Vgtk_initial_argv_list)) | |
227 { | |
563 | 228 invalid_operation ("gtk-initial-argv-list must be set before creating Gtk devices", Vgtk_initial_argv_list); |
462 | 229 return; |
230 } | |
231 | |
232 allocate_gtk_device_struct (d); | |
233 display = DEVICE_CONNECTION (d); | |
234 | |
235 /* Attempt to load a site-specific gtkrc */ | |
236 { | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4477
diff
changeset
|
237 Lisp_Object gtkrc = Fexpand_file_name (build_ascstring ("gtkrc"), Vdata_directory); |
462 | 238 gchar **default_files = gtk_rc_get_default_files (); |
239 gint num_files; | |
240 | |
241 if (STRINGP (gtkrc)) | |
242 { | |
243 /* Found one, load it up! */ | |
244 gchar **new_rc_files = NULL; | |
245 int ctr; | |
246 | |
247 for (num_files = 0; default_files[num_files]; num_files++); | |
248 | |
249 new_rc_files = xnew_array_and_zero (gchar *, num_files + 3); | |
250 | |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4962
diff
changeset
|
251 LISP_PATHNAME_CONVERT_OUT (gtkrc, new_rc_files[0]); |
2054 | 252 |
462 | 253 for (ctr = 1; default_files[ctr-1]; ctr++) |
254 new_rc_files[ctr] = g_strdup (default_files[ctr-1]); | |
255 | |
256 gtk_rc_set_default_files (new_rc_files); | |
257 | |
258 for (ctr = 1; new_rc_files[ctr]; ctr++) | |
259 free(new_rc_files[ctr]); | |
260 | |
4976
16112448d484
Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents:
4962
diff
changeset
|
261 xfree (new_rc_files); |
462 | 262 } |
263 } | |
264 | |
265 Fgtk_init (Vgtk_initial_argv_list); | |
266 | |
267 #ifdef __FreeBSD__ | |
268 gdk_set_use_xshm (FALSE); | |
269 #endif | |
270 | |
271 #ifdef HAVE_GDK_IMLIB_INIT | |
272 /* Some themes in Gtk are so lame (most notably the Pixmap theme) | |
273 that they rely on gdk_imlib, but don't call its initialization | |
274 routines. This makes them USELESS for non-gnome applications. | |
275 So we bend over backwards to try and make them work. Losers. */ | |
276 gdk_imlib_init (); | |
277 #endif | |
278 | |
279 if (NILP (DEVICE_NAME (d))) | |
280 DEVICE_NAME (d) = display; | |
281 | |
282 /* Always search for the best visual */ | |
283 visual = gdk_visual_get_best(); | |
284 cmap = gdk_colormap_new (visual, TRUE); | |
285 | |
286 DEVICE_GTK_VISUAL (d) = visual; | |
287 DEVICE_GTK_COLORMAP (d) = cmap; | |
288 DEVICE_GTK_DEPTH (d) = visual->depth; | |
289 | |
290 { | |
291 GtkWidget *w = gtk_window_new (GTK_WINDOW_TOPLEVEL); | |
292 | |
293 app_shell = gtk_xemacs_new (NULL); | |
294 gtk_container_add (GTK_CONTAINER (w), app_shell); | |
295 | |
296 gtk_widget_realize (w); | |
297 } | |
298 | |
299 DEVICE_GTK_APP_SHELL (d) = app_shell; | |
300 | |
301 /* Realize the app_shell so that its window exists for GC creation | |
302 purposes */ | |
303 gtk_widget_realize (GTK_WIDGET (app_shell)); | |
304 | |
305 /* Need to set up some selection handlers */ | |
306 gtk_selection_add_target (GTK_WIDGET (app_shell), GDK_SELECTION_PRIMARY, | |
307 GDK_SELECTION_TYPE_STRING, 0); | |
746 | 308 gtk_selection_add_target (GTK_WIDGET (app_shell), |
309 gdk_atom_intern("CLIPBOARD", FALSE), | |
310 GDK_SELECTION_TYPE_STRING, 0); | |
462 | 311 |
312 gtk_signal_connect (GTK_OBJECT (app_shell), "selection_get", | |
313 GTK_SIGNAL_FUNC (emacs_gtk_selection_handle), NULL); | |
746 | 314 gtk_signal_connect (GTK_OBJECT (app_shell), "selection_clear_event", |
315 GTK_SIGNAL_FUNC (emacs_gtk_selection_clear_event_handle), | |
316 NULL); | |
462 | 317 gtk_signal_connect (GTK_OBJECT (app_shell), "selection_received", |
318 GTK_SIGNAL_FUNC (emacs_gtk_selection_received), NULL); | |
319 | |
320 DEVICE_GTK_WM_COMMAND_FRAME (d) = Qnil; | |
321 | |
322 gtk_init_modifier_mapping (d); | |
323 | |
324 gtk_device_init_x_specific_cruft (d); | |
325 | |
326 init_baud_rate (d); | |
327 init_one_device (d); | |
328 | |
329 DEVICE_GTK_GC_CACHE (d) = make_gc_cache (GTK_WIDGET (app_shell)); | |
330 DEVICE_GTK_GRAY_PIXMAP (d) = NULL; | |
331 | |
332 gtk_init_device_class (d); | |
333 } | |
334 | |
335 static void | |
4477
e34711681f30
Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents:
4117
diff
changeset
|
336 gtk_finish_init_device (struct device *d, Lisp_Object UNUSED (props)) |
462 | 337 { |
4477
e34711681f30
Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents:
4117
diff
changeset
|
338 call1 (Qmake_device_late_gtk_entry_point, wrap_device(d)); |
462 | 339 } |
340 | |
341 static void | |
342 gtk_mark_device (struct device *d) | |
343 { | |
344 mark_object (DEVICE_GTK_WM_COMMAND_FRAME (d)); | |
345 mark_object (DEVICE_GTK_DATA (d)->x_keysym_map_hashtable); | |
346 } | |
347 | |
348 | |
349 /************************************************************************/ | |
350 /* closing an X connection */ | |
351 /************************************************************************/ | |
352 | |
4117 | 353 #ifndef NEW_GC |
462 | 354 static void |
355 free_gtk_device_struct (struct device *d) | |
356 { | |
4976
16112448d484
Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents:
4962
diff
changeset
|
357 xfree (d->device_data); |
4117 | 358 } |
3092 | 359 #endif /* not NEW_GC */ |
462 | 360 |
361 static void | |
362 gtk_delete_device (struct device *d) | |
363 { | |
364 #ifdef FREE_CHECKING | |
365 extern void (*__free_hook)(); | |
366 int checking_free; | |
367 #endif | |
368 | |
369 if (1) | |
370 { | |
371 #ifdef FREE_CHECKING | |
372 checking_free = (__free_hook != 0); | |
373 | |
374 /* Disable strict free checking, to avoid bug in X library */ | |
375 if (checking_free) | |
376 disable_strict_free_check (); | |
377 #endif | |
378 | |
379 free_gc_cache (DEVICE_GTK_GC_CACHE (d)); | |
380 | |
381 #ifdef FREE_CHECKING | |
382 if (checking_free) | |
383 enable_strict_free_check (); | |
384 #endif | |
385 } | |
386 | |
387 free_gtk_device_struct (d); | |
388 } | |
389 | |
390 | |
391 /************************************************************************/ | |
392 /* handle X errors */ | |
393 /************************************************************************/ | |
394 | |
395 const char * | |
396 gtk_event_name (GdkEventType event_type) | |
397 { | |
398 GtkEnumValue *vals = gtk_type_enum_get_values (GTK_TYPE_GDK_EVENT_TYPE); | |
399 | |
778 | 400 while (vals && ((GdkEventType)(vals->value) != event_type)) vals++; |
462 | 401 |
402 if (vals) | |
403 return (vals->value_nick); | |
404 | |
405 return (NULL); | |
406 } | |
407 | |
408 | |
409 /************************************************************************/ | |
410 /* display information functions */ | |
411 /************************************************************************/ | |
412 | |
413 DEFUN ("gtk-display-visual-class", Fgtk_display_visual_class, 0, 1, 0, /* | |
414 Return the visual class of the GTK display DEVICE is using. | |
415 The returned value will be one of the symbols `static-gray', `gray-scale', | |
416 `static-color', `pseudo-color', `true-color', or `direct-color'. | |
417 */ | |
418 (device)) | |
419 { | |
420 GdkVisual *vis = DEVICE_GTK_VISUAL (decode_gtk_device (device)); | |
421 switch (vis->type) | |
422 { | |
423 case GDK_VISUAL_STATIC_GRAY: return intern ("static-gray"); | |
424 case GDK_VISUAL_GRAYSCALE: return intern ("gray-scale"); | |
425 case GDK_VISUAL_STATIC_COLOR: return intern ("static-color"); | |
426 case GDK_VISUAL_PSEUDO_COLOR: return intern ("pseudo-color"); | |
427 case GDK_VISUAL_TRUE_COLOR: return intern ("true-color"); | |
428 case GDK_VISUAL_DIRECT_COLOR: return intern ("direct-color"); | |
429 default: | |
563 | 430 invalid_state ("display has an unknown visual class", Qunbound); |
462 | 431 return Qnil; /* suppress compiler warning */ |
432 } | |
433 } | |
434 | |
435 DEFUN ("gtk-display-visual-depth", Fgtk_display_visual_depth, 0, 1, 0, /* | |
436 Return the bitplane depth of the visual the GTK display DEVICE is using. | |
437 */ | |
438 (device)) | |
439 { | |
440 return make_int (DEVICE_GTK_DEPTH (decode_gtk_device (device))); | |
441 } | |
442 | |
443 static Lisp_Object | |
444 gtk_device_system_metrics (struct device *d, | |
445 enum device_metrics m) | |
446 { | |
447 #if 0 | |
448 GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (DEVICE_GTK_APP_SHELL (d))); | |
449 | |
450 style = gtk_style_attach (style, w); | |
451 #endif | |
452 | |
453 switch (m) | |
454 { | |
455 case DM_size_device: | |
456 return Fcons (make_int (gdk_screen_width ()), | |
457 make_int (gdk_screen_height ())); | |
458 case DM_size_device_mm: | |
459 return Fcons (make_int (gdk_screen_width_mm ()), | |
460 make_int (gdk_screen_height_mm ())); | |
461 case DM_num_color_cells: | |
462 return make_int (gdk_colormap_get_system_size ()); | |
463 case DM_num_bit_planes: | |
464 return make_int (DEVICE_GTK_DEPTH (d)); | |
465 | |
466 #if 0 | |
467 case DM_color_default: | |
468 case DM_color_select: | |
469 case DM_color_balloon: | |
470 case DM_color_3d_face: | |
471 case DM_color_3d_light: | |
472 case DM_color_3d_dark: | |
473 case DM_color_menu: | |
474 case DM_color_menu_highlight: | |
475 case DM_color_menu_button: | |
476 case DM_color_menu_disabled: | |
477 case DM_color_toolbar: | |
478 case DM_color_scrollbar: | |
479 case DM_color_desktop: | |
480 case DM_color_workspace: | |
481 case DM_font_default: | |
482 case DM_font_menubar: | |
483 case DM_font_dialog: | |
484 case DM_size_cursor: | |
485 case DM_size_scrollbar: | |
486 case DM_size_menu: | |
487 case DM_size_toolbar: | |
488 case DM_size_toolbar_button: | |
489 case DM_size_toolbar_border: | |
490 case DM_size_icon: | |
491 case DM_size_icon_small: | |
492 case DM_size_workspace: | |
493 case DM_device_dpi: | |
494 case DM_mouse_buttons: | |
495 case DM_swap_buttons: | |
496 case DM_show_sounds: | |
497 case DM_slow_device: | |
498 case DM_security: | |
499 #endif | |
500 default: /* No such device metric property for GTK devices */ | |
501 return Qunbound; | |
502 } | |
503 } | |
504 | |
505 DEFUN ("gtk-keysym-on-keyboard-p", Fgtk_keysym_on_keyboard_p, 1, 2, 0, /* | |
506 Return true if KEYSYM names a key on the keyboard of DEVICE. | |
507 More precisely, return true if some keystroke (possibly including modifiers) | |
508 on the keyboard of DEVICE keys generates KEYSYM. | |
509 Valid keysyms are listed in the files /usr/include/X11/keysymdef.h and in | |
510 /usr/lib/X11/XKeysymDB, or whatever the equivalents are on your system. | |
511 The keysym name can be provided in two forms: | |
512 - if keysym is a string, it must be the name as known to X windows. | |
513 - if keysym is a symbol, it must be the name as known to XEmacs. | |
514 The two names differ in capitalization and underscoring. | |
515 */ | |
516 (keysym, device)) | |
517 { | |
518 struct device *d = decode_device (device); | |
519 | |
520 if (!DEVICE_GTK_P (d)) | |
563 | 521 gui_error ("Not a GTK device", device); |
462 | 522 |
523 return (NILP (Fgethash (keysym, DEVICE_GTK_DATA (d)->x_keysym_map_hashtable, Qnil)) ? | |
524 Qnil : Qt); | |
525 } | |
526 | |
527 | |
528 /************************************************************************/ | |
529 /* grabs and ungrabs */ | |
530 /************************************************************************/ | |
531 | |
532 DEFUN ("gtk-grab-pointer", Fgtk_grab_pointer, 0, 3, 0, /* | |
533 Grab the pointer and restrict it to its current window. | |
534 If optional DEVICE argument is nil, the default device will be used. | |
535 If optional CURSOR argument is non-nil, change the pointer shape to that | |
536 until `gtk-ungrab-pointer' is called (it should be an object returned by the | |
537 `make-cursor-glyph' function). | |
538 If the second optional argument IGNORE-KEYBOARD is non-nil, ignore all | |
539 keyboard events during the grab. | |
540 Returns t if the grab is successful, nil otherwise. | |
541 */ | |
2286 | 542 (device, cursor, UNUSED (ignore_keyboard))) |
462 | 543 { |
544 GdkWindow *w; | |
545 int result; | |
546 struct device *d = decode_gtk_device (device); | |
547 | |
548 if (!NILP (cursor)) | |
549 { | |
550 CHECK_POINTER_GLYPH (cursor); | |
551 cursor = glyph_image_instance (cursor, device, ERROR_ME, 0); | |
552 } | |
553 | |
554 /* We should call gdk_pointer_grab() and (possibly) gdk_keyboard_grab() here instead */ | |
555 w = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (device_selected_frame (d))); | |
556 | |
557 result = gdk_pointer_grab (w, FALSE, | |
2054 | 558 (GdkEventMask) (GDK_POINTER_MOTION_MASK | |
559 GDK_POINTER_MOTION_HINT_MASK | | |
560 GDK_BUTTON1_MOTION_MASK | | |
561 GDK_BUTTON2_MOTION_MASK | | |
562 GDK_BUTTON3_MOTION_MASK | | |
563 GDK_BUTTON_PRESS_MASK | | |
564 GDK_BUTTON_RELEASE_MASK), | |
462 | 565 w, |
566 NULL, /* #### BILL!!! Need to create a GdkCursor * as necessary! */ | |
567 GDK_CURRENT_TIME); | |
568 | |
569 return (result == 0) ? Qt : Qnil; | |
570 } | |
571 | |
572 DEFUN ("gtk-ungrab-pointer", Fgtk_ungrab_pointer, 0, 1, 0, /* | |
573 Release a pointer grab made with `gtk-grab-pointer'. | |
574 If optional first arg DEVICE is nil the default device is used. | |
575 If it is t the pointer will be released on all GTK devices. | |
576 */ | |
577 (device)) | |
578 { | |
579 if (!EQ (device, Qt)) | |
580 { | |
581 gdk_pointer_ungrab (GDK_CURRENT_TIME); | |
582 } | |
583 else | |
584 { | |
585 Lisp_Object devcons, concons; | |
586 | |
587 DEVICE_LOOP_NO_BREAK (devcons, concons) | |
588 { | |
589 struct device *d = XDEVICE (XCAR (devcons)); | |
590 | |
591 if (DEVICE_GTK_P (d)) | |
592 gdk_pointer_ungrab (GDK_CURRENT_TIME); | |
593 } | |
594 } | |
595 return Qnil; | |
596 } | |
597 | |
598 DEFUN ("gtk-grab-keyboard", Fgtk_grab_keyboard, 0, 1, 0, /* | |
599 Grab the keyboard on the given device (defaulting to the selected one). | |
600 So long as the keyboard is grabbed, all keyboard events will be delivered | |
601 to emacs -- it is not possible for other clients to eavesdrop on them. | |
602 Ungrab the keyboard with `gtk-ungrab-keyboard' (use an unwind-protect). | |
603 Returns t if the grab is successful, nil otherwise. | |
604 */ | |
605 (device)) | |
606 { | |
607 struct device *d = decode_gtk_device (device); | |
608 GdkWindow *w = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (device_selected_frame (d))); | |
609 | |
610 gdk_keyboard_grab (w, FALSE, GDK_CURRENT_TIME ); | |
611 | |
612 return Qt; | |
613 } | |
614 | |
615 DEFUN ("gtk-ungrab-keyboard", Fgtk_ungrab_keyboard, 0, 1, 0, /* | |
616 Release a keyboard grab made with `gtk-grab-keyboard'. | |
617 */ | |
2286 | 618 (UNUSED (device))) |
462 | 619 { |
620 gdk_keyboard_ungrab (GDK_CURRENT_TIME); | |
621 return Qnil; | |
622 } | |
623 | |
624 | |
625 /************************************************************************/ | |
626 /* Style Info */ | |
627 /************************************************************************/ | |
628 DEFUN ("gtk-style-info", Fgtk_style_info, 0, 1, 0, /* | |
629 Get the style information for a Gtk device. | |
630 */ | |
631 (device)) | |
632 { | |
633 struct device *d = decode_device (device); | |
634 GtkStyle *style = NULL; | |
635 Lisp_Object result = Qnil; | |
636 GtkWidget *app_shell = GTK_WIDGET (DEVICE_GTK_APP_SHELL (d)); | |
637 GdkWindow *w = GET_GTK_WIDGET_WINDOW (app_shell); | |
638 | |
639 if (!DEVICE_GTK_P (d)) | |
640 return (Qnil); | |
641 | |
642 style = gtk_widget_get_style (app_shell); | |
643 style = gtk_style_attach (style, w); | |
644 | |
645 if (!style) return (Qnil); | |
646 | |
647 #define FROB_COLOR(slot, name) \ | |
648 result = nconc2 (result, \ | |
649 list2 (intern (name), \ | |
650 list5 (xemacs_gtk_convert_color (&style->slot[GTK_STATE_NORMAL], app_shell),\ | |
651 xemacs_gtk_convert_color (&style->slot[GTK_STATE_ACTIVE], app_shell),\ | |
652 xemacs_gtk_convert_color (&style->slot[GTK_STATE_PRELIGHT], app_shell),\ | |
653 xemacs_gtk_convert_color (&style->slot[GTK_STATE_SELECTED], app_shell),\ | |
654 xemacs_gtk_convert_color (&style->slot[GTK_STATE_INSENSITIVE], app_shell)))) | |
655 | |
656 FROB_COLOR (fg, "foreground"); | |
657 FROB_COLOR (bg, "background"); | |
658 FROB_COLOR (light, "light"); | |
659 FROB_COLOR (dark, "dark"); | |
660 FROB_COLOR (mid, "mid"); | |
661 FROB_COLOR (text, "text"); | |
662 FROB_COLOR (base, "base"); | |
663 #undef FROB_COLOR | |
664 | |
665 result = nconc2 (result, list2 (Qfont, convert_font (style->font))); | |
666 | |
4953
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
667 #define FROB_PIXMAP(state) (style->rc_style->bg_pixmap_name[state] ? build_cistring (style->rc_style->bg_pixmap_name[state]) : Qnil) |
462 | 668 |
669 if (style->rc_style) | |
670 result = nconc2 (result, list2 (Qbackground, | |
671 list5 ( FROB_PIXMAP (GTK_STATE_NORMAL), | |
672 FROB_PIXMAP (GTK_STATE_ACTIVE), | |
673 FROB_PIXMAP (GTK_STATE_PRELIGHT), | |
674 FROB_PIXMAP (GTK_STATE_SELECTED), | |
675 FROB_PIXMAP (GTK_STATE_INSENSITIVE)))); | |
676 #undef FROB_PIXMAP | |
677 | |
678 return (result); | |
679 } | |
680 | |
681 | |
682 /************************************************************************/ | |
683 /* initialization */ | |
684 /************************************************************************/ | |
685 | |
686 void | |
687 syms_of_device_gtk (void) | |
688 { | |
3092 | 689 #ifdef NEW_GC |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4477
diff
changeset
|
690 INIT_LISP_OBJECT (gtk_device); |
3092 | 691 #endif /* NEW_GC */ |
692 | |
462 | 693 DEFSUBR (Fgtk_keysym_on_keyboard_p); |
694 DEFSUBR (Fgtk_display_visual_class); | |
695 DEFSUBR (Fgtk_display_visual_depth); | |
696 DEFSUBR (Fgtk_style_info); | |
697 DEFSUBR (Fgtk_grab_pointer); | |
698 DEFSUBR (Fgtk_ungrab_pointer); | |
699 DEFSUBR (Fgtk_grab_keyboard); | |
700 DEFSUBR (Fgtk_ungrab_keyboard); | |
701 DEFSUBR (Fgtk_init); | |
702 | |
4477
e34711681f30
Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents:
4117
diff
changeset
|
703 DEFSYMBOL (Qmake_device_early_gtk_entry_point); |
e34711681f30
Don't determine whether to call general device-type code at startup,
Aidan Kehoe <kehoea@parhasard.net>
parents:
4117
diff
changeset
|
704 DEFSYMBOL (Qmake_device_late_gtk_entry_point); |
462 | 705 } |
706 | |
707 void | |
708 console_type_create_device_gtk (void) | |
709 { | |
710 CONSOLE_HAS_METHOD (gtk, init_device); | |
711 CONSOLE_HAS_METHOD (gtk, finish_init_device); | |
712 CONSOLE_HAS_METHOD (gtk, mark_device); | |
713 CONSOLE_HAS_METHOD (gtk, delete_device); | |
714 CONSOLE_HAS_METHOD (gtk, device_system_metrics); | |
545 | 715 /* CONSOLE_IMPLEMENTATION_FLAGS (gtk, XDEVIMPF_PIXEL_GEOMETRY); */ |
716 /* I inserted the above commented out statement, as the original | |
717 implementation of gtk_device_implementation_flags(), which I | |
718 deleted, contained commented out XDEVIMPF_PIXEL_GEOMETRY - kkm*/ | |
462 | 719 } |
720 | |
721 void | |
722 vars_of_device_gtk (void) | |
723 { | |
724 Fprovide (Qgtk); | |
725 | |
726 DEFVAR_LISP ("gtk-initial-argv-list", &Vgtk_initial_argv_list /* | |
727 You don't want to know. | |
728 This is used during startup to communicate the remaining arguments in | |
729 `command-line-args-left' to the C code, which passes the args to | |
730 the GTK initialization code, which removes some args, and then the | |
731 args are placed back into `gtk-initial-arg-list' and thence into | |
732 `command-line-args-left'. Perhaps `command-line-args-left' should | |
733 just reside in C. | |
734 */ ); | |
735 | |
736 DEFVAR_LISP ("gtk-initial-geometry", &Vgtk_initial_geometry /* | |
737 You don't want to know. | |
738 This is used during startup to communicate the default geometry to GTK. | |
739 */ ); | |
740 | |
741 Vgtk_initial_geometry = Qnil; | |
742 Vgtk_initial_argv_list = Qnil; | |
2828 | 743 |
744 Qgtk_seen_characters = Qnil; | |
462 | 745 } |
746 | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4477
diff
changeset
|
747 #include "sysgdkx.h" |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4477
diff
changeset
|
748 |
462 | 749 static void |
750 gtk_device_init_x_specific_cruft (struct device *d) | |
751 { | |
752 DEVICE_INFD (d) = DEVICE_OUTFD (d) = ConnectionNumber (GDK_DISPLAY ()); | |
753 } |