annotate src/gtk-glue.c @ 5464:e79916901603 r21-5-30

XEmacs 21.5.30 "garlic" is released.
author Stephen J. Turnbull <stephen@xemacs.org>
date Wed, 27 Apr 2011 01:24:28 +0900
parents cd167465bf69
children b9167d522a9a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5287
cd167465bf69 More permission consistency.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 5231
diff changeset
1 /* gtk-glue.c --- GTK interfaces with XEmacs
cd167465bf69 More permission consistency.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 5231
diff changeset
2
cd167465bf69 More permission consistency.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 5231
diff changeset
3 Copyright (C) 2000, 2001 William M. Perry
cd167465bf69 More permission consistency.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 5231
diff changeset
4
4709
db7068430402 Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents: 2500
diff changeset
5 This file is part of XEmacs.
db7068430402 Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents: 2500
diff changeset
6
db7068430402 Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents: 2500
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
db7068430402 Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents: 2500
diff changeset
8 under the terms of the GNU General Public License as published by the
db7068430402 Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents: 2500
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
db7068430402 Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents: 2500
diff changeset
10 later version.
db7068430402 Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents: 2500
diff changeset
11
db7068430402 Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents: 2500
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
db7068430402 Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents: 2500
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
db7068430402 Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents: 2500
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
db7068430402 Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents: 2500
diff changeset
15 for more details.
db7068430402 Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents: 2500
diff changeset
16
db7068430402 Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents: 2500
diff changeset
17 You should have received a copy of the GNU General Public License
db7068430402 Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents: 2500
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
db7068430402 Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents: 2500
diff changeset
19 the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
5231
ba07c880114a Fix up FSF's Franklin Street address in many files.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 5178
diff changeset
20 Boston, MA 02110-1301, USA. */
4709
db7068430402 Add explicit GPL v2 or later notices to Bill Perry's code, where such notices
Jerry James <james@xemacs.org>
parents: 2500
diff changeset
21
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
22 GtkType GTK_TYPE_ARRAY = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
23 GtkType GTK_TYPE_STRING_ARRAY = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
24 GtkType GTK_TYPE_FLOAT_ARRAY = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
25 GtkType GTK_TYPE_INT_ARRAY = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
26 GtkType GTK_TYPE_LISTOF = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
27 GtkType GTK_TYPE_STRING_LIST = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
28 GtkType GTK_TYPE_OBJECT_LIST = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
29 GtkType GTK_TYPE_GDK_GC = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
30
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
31 #include "console-gtk.h"
5176
8b2f75cecb89 rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents: 4962
diff changeset
32 #include "fontcolor-gtk-impl.h"
876
890f3cafe600 [xemacs-hg @ 2002-06-23 09:25:11 by stephent]
stephent
parents: 778
diff changeset
33
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
34 static GtkType
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
35 xemacs_type_register (gchar *name, GtkType parent)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
36 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
37 GtkType type_id;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
38 GtkTypeInfo info;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
39
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
40 info.type_name = name;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
41 info.object_size = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
42 info.class_size = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
43 info.class_init_func = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
44 info.object_init_func = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
45 info.reserved_1 = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
46 info.reserved_2 = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
47
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
48 type_id = gtk_type_unique (parent, &info);
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 return (type_id);
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
53 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
54 xemacs_init_gtk_classes (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
55 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
56 if (!GTK_TYPE_ARRAY)
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 GTK_TYPE_ARRAY = xemacs_type_register ("GtkArrayOf", 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
59 GTK_TYPE_STRING_ARRAY = xemacs_type_register ("GtkArrayOfString", GTK_TYPE_ARRAY);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
60 GTK_TYPE_FLOAT_ARRAY = xemacs_type_register ("GtkArrayOfFloat", GTK_TYPE_ARRAY);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
61 GTK_TYPE_INT_ARRAY = xemacs_type_register ("GtkArrayOfInteger", GTK_TYPE_ARRAY);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
62 GTK_TYPE_LISTOF = xemacs_type_register ("GtkListOf", 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
63 GTK_TYPE_STRING_LIST = xemacs_type_register ("GtkListOfString", GTK_TYPE_LISTOF);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
64 GTK_TYPE_OBJECT_LIST = xemacs_type_register ("GtkListOfObject", GTK_TYPE_LISTOF);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
65 GTK_TYPE_GDK_GC = xemacs_type_register ("GdkGC", GTK_TYPE_BOXED);
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 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
68
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
69 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
70 xemacs_list_to_gtklist (Lisp_Object obj, GtkArg *arg)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
71 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
72 CHECK_LIST (obj);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
73
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
74 if (arg->type == GTK_TYPE_STRING_LIST)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
75 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
76 Lisp_Object temp = obj;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
77 GList *strings = NULL;
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 while (!NILP (temp))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
80 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
81 CHECK_STRING (XCAR (temp));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
82 temp = XCDR (temp);
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 temp = obj;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
86
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
87 while (!NILP (temp))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
88 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
89 strings = g_list_append (strings, XSTRING_DATA (XCAR (temp)));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
90 temp = XCDR (temp);
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
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
93 GTK_VALUE_POINTER (*arg) = strings;
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
94 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
95 else if (arg->type == GTK_TYPE_OBJECT_LIST)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
96 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
97 Lisp_Object temp = obj;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
98 GList *objects = NULL;
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 while (!NILP (temp))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
101 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
102 CHECK_GTK_OBJECT (XCAR (temp));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
103 temp = XCDR (temp);
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
106 temp = obj;
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 while (!NILP (temp))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
109 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
110 objects = g_list_append (objects, XGTK_OBJECT (XCAR (temp))->object);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
111 temp = XCDR (temp);
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
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
114 GTK_VALUE_POINTER (*arg) = objects;
462
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 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
117 {
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
118 ABORT ();
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
122 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
123 __make_gtk_object_mapper (gpointer data, gpointer user_data)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
124 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
125 Lisp_Object *rv = (Lisp_Object *) user_data;
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 *rv = Fcons (build_gtk_object (GTK_OBJECT (data)), *rv);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
128 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
129
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
130 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
131 __make_string_mapper (gpointer data, gpointer user_data)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
132 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
133 Lisp_Object *rv = (Lisp_Object *) user_data;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
134
4953
304aebb79cd3 function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
135 *rv = Fcons (build_cistring ((char *)data), *rv);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
136 }
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 static Lisp_Object
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
139 xemacs_gtklist_to_list (GtkArg *arg)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
140 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
141 Lisp_Object rval = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
142
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
143 if (GTK_VALUE_POINTER (*arg))
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 if (arg->type == GTK_TYPE_STRING_LIST)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
146 {
2054
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1204
diff changeset
147 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
148 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
149 else if (arg->type == GTK_TYPE_OBJECT_LIST)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
150 {
2054
91d4c8c65a0f [xemacs-hg @ 2004-05-02 04:06:51 by malcolmp]
malcolmp
parents: 1204
diff changeset
151 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
152 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
153 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
154 {
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
155 ABORT ();
462
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 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
158 return (rval);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
159 }
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 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
162 xemacs_list_to_array (Lisp_Object obj, GtkArg *arg)
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 CHECK_LIST (obj);
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 #define FROB(ret_type,check_fn,extract_fn) \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
167 do { \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
168 Lisp_Object temp = obj; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
169 int length = 0; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
170 ret_type *array = NULL; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
171 \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
172 while (!NILP (temp)) \
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 check_fn (XCAR (temp)); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
175 length++; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
176 temp = XCDR (temp); \
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 \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
179 array = xnew_array_and_zero (ret_type, length + 2); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
180 temp = obj; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
181 length = 0; \
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 while (!NILP (temp)) \
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 array[length++] = extract_fn (XCAR (temp)); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
186 temp = XCDR (temp); \
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 \
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
189 GTK_VALUE_POINTER (*arg) = array; \
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
190 } while (0);
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 if (arg->type == GTK_TYPE_STRING_ARRAY)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
193 {
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
194 FROB (gchar *, CHECK_STRING, (gchar*) XSTRING_DATA);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
195 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
196 else if (arg->type == GTK_TYPE_FLOAT_ARRAY)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
197 {
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
198 FROB (gfloat, CHECK_FLOAT, extract_float);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
199 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
200 else if (arg->type == GTK_TYPE_INT_ARRAY)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
201 {
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
202 FROB (gint, CHECK_INT, XINT);
462
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 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
205 {
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
206 ABORT ();
462
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 #undef FROB
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
209 }
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 static GdkGC *
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
212 face_to_gc (Lisp_Object face)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
213 {
5074
8af6a32b170d Modify XLIKE_get_gc's prototype
Didier Verna <didier@lrde.epita.fr>
parents: 4962
diff changeset
214 Lisp_Object frame = Fselected_frame (Qnil);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
215
5074
8af6a32b170d Modify XLIKE_get_gc's prototype
Didier Verna <didier@lrde.epita.fr>
parents: 4962
diff changeset
216 return (gtk_get_gc (XFRAME (frame),
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
217 Fspecifier_instance (Fget (face, Qfont, Qnil),
5074
8af6a32b170d Modify XLIKE_get_gc's prototype
Didier Verna <didier@lrde.epita.fr>
parents: 4962
diff changeset
218 frame, Qnil, Qnil),
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
219 Fspecifier_instance (Fget (face, Qforeground, Qnil),
5074
8af6a32b170d Modify XLIKE_get_gc's prototype
Didier Verna <didier@lrde.epita.fr>
parents: 4962
diff changeset
220 frame, Qnil, Qnil),
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
221 Fspecifier_instance (Fget (face, Qbackground, Qnil),
5074
8af6a32b170d Modify XLIKE_get_gc's prototype
Didier Verna <didier@lrde.epita.fr>
parents: 4962
diff changeset
222 frame, Qnil, Qnil),
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
223 Fspecifier_instance (Fget (face, Qbackground_pixmap,
5074
8af6a32b170d Modify XLIKE_get_gc's prototype
Didier Verna <didier@lrde.epita.fr>
parents: 4962
diff changeset
224 Qnil),
8af6a32b170d Modify XLIKE_get_gc's prototype
Didier Verna <didier@lrde.epita.fr>
parents: 4962
diff changeset
225 frame, Qnil, Qnil),
5080
5502045ec510 The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents: 5074
diff changeset
226 Fspecifier_instance (Fget (face, Qbackground_placement,
5502045ec510 The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents: 5074
diff changeset
227 Qnil),
5502045ec510 The background-placement face property.
Didier Verna <didier@lrde.epita.fr>
parents: 5074
diff changeset
228 frame, Qnil, Qnil),
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
229 Qnil));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
230 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
231
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
232 static GtkStyle *
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
233 face_to_style (Lisp_Object face)
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 Lisp_Object device = Fselected_device (Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
236 GtkStyle *style = gtk_style_new ();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
237 int i;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
238
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
239 Lisp_Object font = Fspecifier_instance (Fget (face, Qfont, Qnil),
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
240 device, Qnil, Qnil);
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
241 Lisp_Object fg = Fspecifier_instance (Fget (face, Qforeground, Qnil),
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
242 device, Qnil, Qnil);
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
243 Lisp_Object bg = Fspecifier_instance (Fget (face, Qbackground, Qnil),
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
244 device, Qnil, Qnil);
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
245 Lisp_Object pm = Fspecifier_instance (Fget (face, Qbackground_pixmap,
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
246 Qnil), device, Qnil, Qnil);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
247
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
248 for (i = 0; i < 5; i++)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
249 style->fg[i] = *COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (fg));
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
250 for (i = 0; i < 5; i++)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
251 style->bg[i] = *COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (bg));
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
252
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
253 if (IMAGE_INSTANCEP (pm))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
254 {
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
255 for (i = 0; i < 5; i++)
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
256 style->bg_pixmap[i] = XIMAGE_INSTANCE_GTK_PIXMAP (pm);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
257 }
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 style->font = FONT_INSTANCE_GTK_FONT (XFONT_INSTANCE (font));
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 (style);
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
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
264 static Lisp_Object
4908
b3ce27ca7647 various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents: 4709
diff changeset
265 gdk_event_to_emacs_event (GdkEvent *ev)
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
266 {
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
267 Lisp_Object event = Qnil;
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
268
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
269 if (ev)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
270 {
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
271 Lisp_Event *emacs_event;
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
272
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
273 event = Fmake_event (Qnil, Qnil);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
274 emacs_event = XEVENT (event);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
275
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
276 if (!gtk_event_to_emacs_event (NULL, ev, emacs_event))
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 /* We need to handle a few more cases than the normal event
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
279 ** loop does. Mainly the double/triple click events.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
280 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
281 if ((ev->type == GDK_2BUTTON_PRESS) || (ev->type == GDK_3BUTTON_PRESS))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
282 {
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
283 set_event_type (emacs_event, misc_user_event);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
284 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
285 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
286 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
287 SET_EVENT_MISC_USER_Y (emacs_event, (int) ev->button.y);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
288 if (ev->type == GDK_2BUTTON_PRESS)
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
289 SET_EVENT_MISC_USER_FUNCTION (emacs_event, intern ("double-click"));
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
290 else
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
291 SET_EVENT_MISC_USER_FUNCTION (emacs_event, intern ("triple-click"));
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
292 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
293 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
294 {
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
295 Fdeallocate_event (event);
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
296 event = Qnil;
462
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 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
299 }
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 876
diff changeset
300 return (event);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
301 }