annotate src/gtk-glue.c @ 4539:061e030e3270

Fix some bugs in load-history construction, built-in symbol file names. lib-src/ChangeLog addition: 2008-12-27 Aidan Kehoe <kehoea@parhasard.net> * make-docfile.c (main): Allow more than one -d argument, followed by a directory to change to. (put_filename): Don't strip directory information; with previous change, allows retrieval of Lisp function and variable origin files from #'built-in-symbol-file relative to lisp-directory. (scan_lisp_file): Don't add an extraneous newline after the file name, put_filename has added the newline already. lisp/ChangeLog addition: 2008-12-27 Aidan Kehoe <kehoea@parhasard.net> * loadup.el (load-history): Add the contents of current-load-list to load-history before clearing it. Move the variable declarations earlier in the file to a format understood by make-docfile.c. * custom.el (custom-declare-variable): Add the variable's symbol to the current file's load history entry correctly, don't use a cons. Eliminate a comment that we don't need to worry about, we don't need to check the `initialized' C variable in Lisp. * bytecomp.el (byte-compile-output-file-form): Merge Andreas Schwab's pre-GPLv3 GNU change of 19970831 here; treat #'custom-declare-variable correctly, generating the docstrings in a format understood by make-docfile.c. * loadhist.el (symbol-file): Correct behaviour for checking autoloaded macros and functions when supplied with a TYPE argument. Accept fully-qualified paths from #'built-in-symbol-file; if a path is not fully-qualified, return it relative to lisp-directory if the filename corresponds to a Lisp file, and relative to (concat source-directory "/src/") otherwise. * make-docfile.el (preloaded-file-list): Rationalise some let bindings a little. Use the "-d" argument to make-docfile.c to supply Lisp paths relative to lisp-directory, not absolutely. Add in loadup.el explicitly to the list of files to be processed by make-docfile.c--it doesn't make sense to add it to preloaded-file-list, since that is used for purposes of byte-compilation too. src/ChangeLog addition: 2008-12-27 Aidan Kehoe <kehoea@parhasard.net> * doc.c (Fbuilt_in_symbol_file): Return a subr's filename immediately if we've found it. Check for compiled function and compiled macro docstrings in DOC too, and return them if they exist. The branch of the if statement focused on functions may have executed, but we may still want to check variable bindings; an else clause isn't appropriate.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 27 Dec 2008 14:05:50 +0000
parents 3d8143fc88e1
children db7068430402
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1 GtkType GTK_TYPE_ARRAY = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
2 GtkType GTK_TYPE_STRING_ARRAY = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
3 GtkType GTK_TYPE_FLOAT_ARRAY = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
4 GtkType GTK_TYPE_INT_ARRAY = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
5 GtkType GTK_TYPE_LISTOF = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
6 GtkType GTK_TYPE_STRING_LIST = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
7 GtkType GTK_TYPE_OBJECT_LIST = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
8 GtkType GTK_TYPE_GDK_GC = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
9
876
890f3cafe600 [xemacs-hg @ 2002-06-23 09:25:11 by stephent]
stephent
parents: 778
diff changeset
10 #include "objects-gtk-impl.h"
890f3cafe600 [xemacs-hg @ 2002-06-23 09:25:11 by stephent]
stephent
parents: 778
diff changeset
11
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
12 static GtkType
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
13 xemacs_type_register (gchar *name, GtkType parent)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
14 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
15 GtkType type_id;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
16 GtkTypeInfo info;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
17
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
18 info.type_name = name;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
19 info.object_size = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
20 info.class_size = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
21 info.class_init_func = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
22 info.object_init_func = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
23 info.reserved_1 = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
24 info.reserved_2 = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
25
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
26 type_id = gtk_type_unique (parent, &info);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
27
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
28 return (type_id);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
29 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
30
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
31 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
32 xemacs_init_gtk_classes (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
33 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
34 if (!GTK_TYPE_ARRAY)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
35 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
36 GTK_TYPE_ARRAY = xemacs_type_register ("GtkArrayOf", 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
37 GTK_TYPE_STRING_ARRAY = xemacs_type_register ("GtkArrayOfString", GTK_TYPE_ARRAY);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
38 GTK_TYPE_FLOAT_ARRAY = xemacs_type_register ("GtkArrayOfFloat", GTK_TYPE_ARRAY);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
39 GTK_TYPE_INT_ARRAY = xemacs_type_register ("GtkArrayOfInteger", GTK_TYPE_ARRAY);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
40 GTK_TYPE_LISTOF = xemacs_type_register ("GtkListOf", 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
41 GTK_TYPE_STRING_LIST = xemacs_type_register ("GtkListOfString", GTK_TYPE_LISTOF);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
42 GTK_TYPE_OBJECT_LIST = xemacs_type_register ("GtkListOfObject", GTK_TYPE_LISTOF);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
43 GTK_TYPE_GDK_GC = xemacs_type_register ("GdkGC", GTK_TYPE_BOXED);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
44 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
45 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
46
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
47 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
48 xemacs_list_to_gtklist (Lisp_Object obj, GtkArg *arg)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
49 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
50 CHECK_LIST (obj);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
51
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
52 if (arg->type == GTK_TYPE_STRING_LIST)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
53 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
54 Lisp_Object temp = obj;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
55 GList *strings = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
56
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
57 while (!NILP (temp))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
58 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
59 CHECK_STRING (XCAR (temp));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
60 temp = XCDR (temp);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
61 }
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 temp = obj;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
64
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
65 while (!NILP (temp))
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 strings = g_list_append (strings, XSTRING_DATA (XCAR (temp)));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
68 temp = XCDR (temp);
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
71 GTK_VALUE_POINTER(*arg) = strings;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
72 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
73 else if (arg->type == GTK_TYPE_OBJECT_LIST)
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 Lisp_Object temp = obj;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
76 GList *objects = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
77
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
78 while (!NILP (temp))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
79 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
80 CHECK_GTK_OBJECT (XCAR (temp));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
81 temp = XCDR (temp);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
82 }
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 temp = obj;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
85
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
86 while (!NILP (temp))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
87 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
88 objects = g_list_append (objects, XGTK_OBJECT (XCAR (temp))->object);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
89 temp = XCDR (temp);
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 GTK_VALUE_POINTER(*arg) = objects;
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 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
95 {
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2054
diff changeset
96 ABORT();
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
97 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
98 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
99
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
100 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
101 __make_gtk_object_mapper (gpointer data, gpointer user_data)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
102 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
103 Lisp_Object *rv = (Lisp_Object *) user_data;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
104
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
105 *rv = Fcons (build_gtk_object (GTK_OBJECT (data)), *rv);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
106 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
107
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
108 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
109 __make_string_mapper (gpointer data, gpointer user_data)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
110 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
111 Lisp_Object *rv = (Lisp_Object *) user_data;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
112
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
113 *rv = Fcons (build_string ((char *)data), *rv);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
114 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
115
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
116 static Lisp_Object
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
117 xemacs_gtklist_to_list (GtkArg *arg)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
118 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
119 Lisp_Object rval = Qnil;
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 if (GTK_VALUE_POINTER (*arg))
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 if (arg->type == GTK_TYPE_STRING_LIST)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
124 {
2054
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1204
diff changeset
125 g_list_foreach ((GList*) GTK_VALUE_POINTER (*arg), __make_string_mapper, &rval);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
126 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
127 else if (arg->type == GTK_TYPE_OBJECT_LIST)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
128 {
2054
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1204
diff changeset
129 g_list_foreach ((GList*) GTK_VALUE_POINTER (*arg), __make_gtk_object_mapper, &rval);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
130 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
131 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
132 {
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2054
diff changeset
133 ABORT();
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
134 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
135 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
136 return (rval);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
137 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
138
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
139 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
140 xemacs_list_to_array (Lisp_Object obj, GtkArg *arg)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
141 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
142 CHECK_LIST (obj);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
143
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
144 #define FROB(ret_type,check_fn,extract_fn) \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
145 do { \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
146 Lisp_Object temp = obj; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
147 int length = 0; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
148 ret_type *array = NULL; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
149 \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
150 while (!NILP (temp)) \
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 check_fn (XCAR (temp)); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
153 length++; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
154 temp = XCDR (temp); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
155 } \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
156 \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
157 array = xnew_array_and_zero (ret_type, length + 2); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
158 temp = obj; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
159 length = 0; \
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 while (!NILP (temp)) \
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 array[length++] = extract_fn (XCAR (temp)); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
164 temp = XCDR (temp); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
165 } \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
166 \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
167 GTK_VALUE_POINTER(*arg) = array; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
168 } while (0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
169
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
170 if (arg->type == GTK_TYPE_STRING_ARRAY)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
171 {
2054
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1204
diff changeset
172 FROB(gchar *, CHECK_STRING, (gchar*) XSTRING_DATA);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
173 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
174 else if (arg->type == GTK_TYPE_FLOAT_ARRAY)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
175 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
176 FROB(gfloat, CHECK_FLOAT, extract_float);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
177 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
178 else if (arg->type == GTK_TYPE_INT_ARRAY)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
179 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
180 FROB(gint, CHECK_INT, XINT);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
181 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
182 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
183 {
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2054
diff changeset
184 ABORT();
462
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 #undef FROB
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
187 }
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 extern GdkGC *gtk_get_gc (struct device *d, Lisp_Object font, Lisp_Object fg, Lisp_Object bg,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
190 Lisp_Object bg_pmap, Lisp_Object lwidth);
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 static GdkGC *
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
193 face_to_gc (Lisp_Object face)
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 Lisp_Object device = Fselected_device (Qnil);
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 return (gtk_get_gc (XDEVICE (device),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
198 Fspecifier_instance (Fget (face, Qfont, Qnil), device, Qnil, Qnil),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
199 Fspecifier_instance (Fget (face, Qforeground, Qnil), device, Qnil, Qnil),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
200 Fspecifier_instance (Fget (face, Qbackground, Qnil), device, Qnil, Qnil),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
201 Fspecifier_instance (Fget (face, Qbackground_pixmap, Qnil), device, Qnil, Qnil),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
202 Qnil));
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
205 static GtkStyle *
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
206 face_to_style (Lisp_Object face)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
207 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
208 Lisp_Object device = Fselected_device (Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
209 GtkStyle *style = gtk_style_new ();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
210 int i;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
211
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
212 Lisp_Object font = Fspecifier_instance (Fget (face, Qfont, Qnil), device, Qnil, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
213 Lisp_Object fg = Fspecifier_instance (Fget (face, Qforeground, Qnil), device, Qnil, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
214 Lisp_Object bg = Fspecifier_instance (Fget (face, Qbackground, Qnil), device, Qnil, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
215 Lisp_Object pm = Fspecifier_instance (Fget (face, Qbackground_pixmap, Qnil), device, Qnil, Qnil);
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 for (i = 0; i < 5; i++) style->fg[i] = * COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (fg));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
218 for (i = 0; i < 5; i++) style->bg[i] = * COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (bg));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
219
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
220 if (IMAGE_INSTANCEP (pm))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
221 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
222 for (i = 0; i < 5; i++) style->bg_pixmap[i] = XIMAGE_INSTANCE_GTK_PIXMAP (pm);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
223 }
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 style->font = FONT_INSTANCE_GTK_FONT (XFONT_INSTANCE (font));
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 return (style);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
228 }
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 Lisp_Object
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
231 gdk_event_to_emacs_event(GdkEvent *ev)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
232 {
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
233 Lisp_Object event = Qnil;
462
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 if (ev)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
236 {
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
237 Lisp_Event *emacs_event;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
238
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
239 event = Fmake_event (Qnil, Qnil);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
240 emacs_event = XEVENT (event);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
241
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
242 if (!gtk_event_to_emacs_event (NULL, ev, emacs_event))
462
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 /* We need to handle a few more cases than the normal event
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
245 ** loop does. Mainly the double/triple click events.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
246 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
247 if ((ev->type == GDK_2BUTTON_PRESS) || (ev->type == GDK_3BUTTON_PRESS))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
248 {
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
249 set_event_type (emacs_event, misc_user_event);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
250 SET_EVENT_MISC_USER_BUTTON (emacs_event, ev->button.button);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
251 SET_EVENT_MISC_USER_MODIFIERS (emacs_event, 0);
2054
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1204
diff changeset
252 SET_EVENT_MISC_USER_X (emacs_event, (int) ev->button.x);
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1204
diff changeset
253 SET_EVENT_MISC_USER_Y (emacs_event, (int) ev->button.y);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
254 if (ev->type == GDK_2BUTTON_PRESS)
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
255 SET_EVENT_MISC_USER_FUNCTION (emacs_event, intern ("double-click"));
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
256 else
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
257 SET_EVENT_MISC_USER_FUNCTION (emacs_event, intern ("triple-click"));
462
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 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
260 {
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
261 Fdeallocate_event (event);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
262 event = Qnil;
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
263 }
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 }
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
266 return (event);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
267 }