Mercurial > hg > xemacs-beta
annotate src/gtk-glue.c @ 5077:d372b17f63ce
clean up toolbar/gutter edge geometry
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-02-25 Ben Wing <ben@xemacs.org>
* EmacsFrame.c (EmacsFrameSetValues):
* frame-impl.h:
* frame-impl.h (struct frame):
* frame-impl.h (FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT):
* frame-impl.h (FRAME_THEORETICAL_TOP_TOOLBAR_BORDER_WIDTH):
* frame-impl.h (FRAME_REAL_TOP_TOOLBAR_HEIGHT):
* frame-impl.h (FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH):
* frame-impl.h (FRAME_REAL_TOP_TOOLBAR_VISIBLE):
* frame-impl.h (FRAME_REAL_TOP_TOOLBAR_BOUNDS):
* frame.h:
* frame.h (enum edge_pos):
* gutter.c:
* gutter.c (get_gutter_coords):
* gutter.c (display_boxes_in_gutter_p):
* gutter.c (construct_window_gutter_spec):
* gutter.c (calculate_gutter_size_from_display_lines):
* gutter.c (calculate_gutter_size):
* gutter.c (output_gutter):
* gutter.c (clear_gutter):
* gutter.c (mark_gutters):
* gutter.c (gutter_extent_signal_changed_region_maybe):
* gutter.c (update_gutter_geometry):
* gutter.c (update_frame_gutter_geometry):
* gutter.c (update_frame_gutters):
* gutter.c (reset_gutter_display_lines):
* gutter.c (redraw_exposed_gutter):
* gutter.c (redraw_exposed_gutters):
* gutter.c (free_frame_gutters):
* gutter.c (decode_gutter_position):
* gutter.c (Fset_default_gutter_position):
* gutter.c (Fgutter_pixel_width):
* gutter.c (Fgutter_pixel_height):
* gutter.c (recompute_overlaying_specifier):
* gutter.c (gutter_specs_changed_1):
* gutter.c (gutter_specs_changed):
* gutter.c (top_gutter_specs_changed):
* gutter.c (bottom_gutter_specs_changed):
* gutter.c (left_gutter_specs_changed):
* gutter.c (right_gutter_specs_changed):
* gutter.c (gutter_geometry_changed_in_window):
* gutter.c (init_frame_gutters):
* gutter.c (specifier_vars_of_gutter):
* gutter.h:
* gutter.h (WINDOW_REAL_TOP_GUTTER_BOUNDS):
* gutter.h (FRAME_TOP_GUTTER_BOUNDS):
* lisp.h (enum edge_style):
* native-gtk-toolbar.c:
* native-gtk-toolbar.c (gtk_output_toolbar):
* native-gtk-toolbar.c (gtk_clear_toolbar):
* native-gtk-toolbar.c (gtk_output_frame_toolbars):
* native-gtk-toolbar.c (gtk_initialize_frame_toolbars):
* toolbar-msw.c:
* toolbar-msw.c (TOOLBAR_HANDLE):
* toolbar-msw.c (allocate_toolbar_item_id):
* toolbar-msw.c (mswindows_clear_toolbar):
* toolbar-msw.c (mswindows_output_toolbar):
* toolbar-msw.c (mswindows_move_toolbar):
* toolbar-msw.c (mswindows_redraw_exposed_toolbars):
* toolbar-msw.c (mswindows_initialize_frame_toolbars):
* toolbar-msw.c (mswindows_output_frame_toolbars):
* toolbar-msw.c (mswindows_clear_frame_toolbars):
* toolbar-msw.c (DELETE_TOOLBAR):
* toolbar-msw.c (mswindows_free_frame_toolbars):
* toolbar-msw.c (mswindows_get_toolbar_button_text):
* toolbar-xlike.c:
* toolbar-xlike.c (__prepare_button_area):
* toolbar-xlike.c (XLIKE_OUTPUT_BUTTONS_LOOP):
* toolbar-xlike.c (xlike_output_toolbar):
* toolbar-xlike.c (xlike_clear_toolbar):
* toolbar-xlike.c (xlike_output_frame_toolbars):
* toolbar-xlike.c (xlike_clear_frame_toolbars):
* toolbar-xlike.c (xlike_redraw_exposed_toolbar):
* toolbar-xlike.c (xlike_redraw_exposed_toolbars):
* toolbar-xlike.c (xlike_redraw_frame_toolbars):
* toolbar.c:
* toolbar.c (decode_toolbar_position):
* toolbar.c (Fset_default_toolbar_position):
* toolbar.c (mark_frame_toolbar_buttons_dirty):
* toolbar.c (compute_frame_toolbar_buttons):
* toolbar.c (set_frame_toolbar):
* toolbar.c (compute_frame_toolbars_data):
* toolbar.c (update_frame_toolbars_geometry):
* toolbar.c (init_frame_toolbars):
* toolbar.c (get_toolbar_coords):
* toolbar.c (CHECK_TOOLBAR):
* toolbar.c (toolbar_buttons_at_pixpos):
* toolbar.c (CTB_ERROR):
* toolbar.c (recompute_overlaying_specifier):
* toolbar.c (specifier_vars_of_toolbar):
* toolbar.h:
* toolbar.h (SET_TOOLBAR_WAS_VISIBLE_FLAG):
Create new enum edge_pos with TOP_EDGE, BOTTOM_EDGE, LEFT_EDGE,
RIGHT_EDGE; subsume TOP_BORDER, TOP_GUTTER, enum toolbar_pos,
enum gutter_pos, etc.
Create EDGE_POS_LOOP, subsuming GUTTER_POS_LOOP.
Create NUM_EDGES, use in many places instead of hardcoded '4'.
Instead of top_toolbar_was_visible, bottom_toolbar_was_visible,
etc. make an array toolbar_was_visible[NUM_EDGES]. This increases
the frame size by 15 bytes or so (could be 3 if we use Boolbytes)
but hardly seems w to matter -- frames are heavy weight objects
anyway. Same with top_gutter_was_visible, etc.
Remove duplicated SET_TOOLBAR_WAS_VISIBLE_FLAG and put defn in
one place (toolbar.h).
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Thu, 25 Feb 2010 04:45:13 -0600 |
parents | e813cf16c015 |
children | 8af6a32b170d 8b2f75cecb89 |
rev | line source |
---|---|
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
|
1 /* |
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
|
2 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
|
3 |
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
|
4 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
|
5 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
|
6 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
|
7 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
|
8 |
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 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
|
10 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
|
11 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
|
12 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
|
13 |
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 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
|
15 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
|
16 the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, |
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 Boston, MA 02111-1301, USA. */ |
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 |
462 | 19 GtkType GTK_TYPE_ARRAY = 0; |
20 GtkType GTK_TYPE_STRING_ARRAY = 0; | |
21 GtkType GTK_TYPE_FLOAT_ARRAY = 0; | |
22 GtkType GTK_TYPE_INT_ARRAY = 0; | |
23 GtkType GTK_TYPE_LISTOF = 0; | |
24 GtkType GTK_TYPE_STRING_LIST = 0; | |
25 GtkType GTK_TYPE_OBJECT_LIST = 0; | |
26 GtkType GTK_TYPE_GDK_GC = 0; | |
27 | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
28 #include "console-gtk.h" |
876 | 29 #include "objects-gtk-impl.h" |
30 | |
462 | 31 static GtkType |
32 xemacs_type_register (gchar *name, GtkType parent) | |
33 { | |
34 GtkType type_id; | |
35 GtkTypeInfo info; | |
36 | |
37 info.type_name = name; | |
38 info.object_size = 0; | |
39 info.class_size = 0; | |
40 info.class_init_func = NULL; | |
41 info.object_init_func = NULL; | |
42 info.reserved_1 = NULL; | |
43 info.reserved_2 = NULL; | |
44 | |
45 type_id = gtk_type_unique (parent, &info); | |
46 | |
47 return (type_id); | |
48 } | |
49 | |
50 static void | |
51 xemacs_init_gtk_classes (void) | |
52 { | |
53 if (!GTK_TYPE_ARRAY) | |
54 { | |
55 GTK_TYPE_ARRAY = xemacs_type_register ("GtkArrayOf", 0); | |
56 GTK_TYPE_STRING_ARRAY = xemacs_type_register ("GtkArrayOfString", GTK_TYPE_ARRAY); | |
57 GTK_TYPE_FLOAT_ARRAY = xemacs_type_register ("GtkArrayOfFloat", GTK_TYPE_ARRAY); | |
58 GTK_TYPE_INT_ARRAY = xemacs_type_register ("GtkArrayOfInteger", GTK_TYPE_ARRAY); | |
59 GTK_TYPE_LISTOF = xemacs_type_register ("GtkListOf", 0); | |
60 GTK_TYPE_STRING_LIST = xemacs_type_register ("GtkListOfString", GTK_TYPE_LISTOF); | |
61 GTK_TYPE_OBJECT_LIST = xemacs_type_register ("GtkListOfObject", GTK_TYPE_LISTOF); | |
62 GTK_TYPE_GDK_GC = xemacs_type_register ("GdkGC", GTK_TYPE_BOXED); | |
63 } | |
64 } | |
65 | |
66 static void | |
67 xemacs_list_to_gtklist (Lisp_Object obj, GtkArg *arg) | |
68 { | |
69 CHECK_LIST (obj); | |
70 | |
71 if (arg->type == GTK_TYPE_STRING_LIST) | |
72 { | |
73 Lisp_Object temp = obj; | |
74 GList *strings = NULL; | |
75 | |
76 while (!NILP (temp)) | |
77 { | |
78 CHECK_STRING (XCAR (temp)); | |
79 temp = XCDR (temp); | |
80 } | |
81 | |
82 temp = obj; | |
83 | |
84 while (!NILP (temp)) | |
85 { | |
86 strings = g_list_append (strings, XSTRING_DATA (XCAR (temp))); | |
87 temp = XCDR (temp); | |
88 } | |
89 | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
90 GTK_VALUE_POINTER (*arg) = strings; |
462 | 91 } |
92 else if (arg->type == GTK_TYPE_OBJECT_LIST) | |
93 { | |
94 Lisp_Object temp = obj; | |
95 GList *objects = NULL; | |
96 | |
97 while (!NILP (temp)) | |
98 { | |
99 CHECK_GTK_OBJECT (XCAR (temp)); | |
100 temp = XCDR (temp); | |
101 } | |
102 | |
103 temp = obj; | |
104 | |
105 while (!NILP (temp)) | |
106 { | |
107 objects = g_list_append (objects, XGTK_OBJECT (XCAR (temp))->object); | |
108 temp = XCDR (temp); | |
109 } | |
110 | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
111 GTK_VALUE_POINTER (*arg) = objects; |
462 | 112 } |
113 else | |
114 { | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
115 ABORT (); |
462 | 116 } |
117 } | |
118 | |
119 static void | |
120 __make_gtk_object_mapper (gpointer data, gpointer user_data) | |
121 { | |
122 Lisp_Object *rv = (Lisp_Object *) user_data; | |
123 | |
124 *rv = Fcons (build_gtk_object (GTK_OBJECT (data)), *rv); | |
125 } | |
126 | |
127 static void | |
128 __make_string_mapper (gpointer data, gpointer user_data) | |
129 { | |
130 Lisp_Object *rv = (Lisp_Object *) user_data; | |
131 | |
4953
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
132 *rv = Fcons (build_cistring ((char *)data), *rv); |
462 | 133 } |
134 | |
135 static Lisp_Object | |
136 xemacs_gtklist_to_list (GtkArg *arg) | |
137 { | |
138 Lisp_Object rval = Qnil; | |
139 | |
140 if (GTK_VALUE_POINTER (*arg)) | |
141 { | |
142 if (arg->type == GTK_TYPE_STRING_LIST) | |
143 { | |
2054 | 144 g_list_foreach ((GList*) GTK_VALUE_POINTER (*arg), __make_string_mapper, &rval); |
462 | 145 } |
146 else if (arg->type == GTK_TYPE_OBJECT_LIST) | |
147 { | |
2054 | 148 g_list_foreach ((GList*) GTK_VALUE_POINTER (*arg), __make_gtk_object_mapper, &rval); |
462 | 149 } |
150 else | |
151 { | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
152 ABORT (); |
462 | 153 } |
154 } | |
155 return (rval); | |
156 } | |
157 | |
158 static void | |
159 xemacs_list_to_array (Lisp_Object obj, GtkArg *arg) | |
160 { | |
161 CHECK_LIST (obj); | |
162 | |
163 #define FROB(ret_type,check_fn,extract_fn) \ | |
164 do { \ | |
165 Lisp_Object temp = obj; \ | |
166 int length = 0; \ | |
167 ret_type *array = NULL; \ | |
168 \ | |
169 while (!NILP (temp)) \ | |
170 { \ | |
171 check_fn (XCAR (temp)); \ | |
172 length++; \ | |
173 temp = XCDR (temp); \ | |
174 } \ | |
175 \ | |
176 array = xnew_array_and_zero (ret_type, length + 2); \ | |
177 temp = obj; \ | |
178 length = 0; \ | |
179 \ | |
180 while (!NILP (temp)) \ | |
181 { \ | |
182 array[length++] = extract_fn (XCAR (temp)); \ | |
183 temp = XCDR (temp); \ | |
184 } \ | |
185 \ | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
186 GTK_VALUE_POINTER (*arg) = array; \ |
462 | 187 } while (0); |
188 | |
189 if (arg->type == GTK_TYPE_STRING_ARRAY) | |
190 { | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
191 FROB (gchar *, CHECK_STRING, (gchar*) XSTRING_DATA); |
462 | 192 } |
193 else if (arg->type == GTK_TYPE_FLOAT_ARRAY) | |
194 { | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
195 FROB (gfloat, CHECK_FLOAT, extract_float); |
462 | 196 } |
197 else if (arg->type == GTK_TYPE_INT_ARRAY) | |
198 { | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
199 FROB (gint, CHECK_INT, XINT); |
462 | 200 } |
201 else | |
202 { | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
203 ABORT (); |
462 | 204 } |
205 #undef FROB | |
206 } | |
207 | |
208 static GdkGC * | |
209 face_to_gc (Lisp_Object face) | |
210 { | |
211 Lisp_Object device = Fselected_device (Qnil); | |
212 | |
213 return (gtk_get_gc (XDEVICE (device), | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
214 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
|
215 device, Qnil, Qnil), |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
216 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
|
217 device, Qnil, Qnil), |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
218 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
|
219 device, Qnil, Qnil), |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
220 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
|
221 Qnil), device, Qnil, Qnil), |
462 | 222 Qnil)); |
223 } | |
224 | |
225 static GtkStyle * | |
226 face_to_style (Lisp_Object face) | |
227 { | |
228 Lisp_Object device = Fselected_device (Qnil); | |
229 GtkStyle *style = gtk_style_new (); | |
230 int i; | |
231 | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
232 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
|
233 device, Qnil, Qnil); |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
234 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
|
235 device, Qnil, Qnil); |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
236 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
|
237 device, Qnil, Qnil); |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
238 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
|
239 Qnil), device, Qnil, Qnil); |
462 | 240 |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
241 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
|
242 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
|
243 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
|
244 style->bg[i] = *COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (bg)); |
462 | 245 |
246 if (IMAGE_INSTANCEP (pm)) | |
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->bg_pixmap[i] = XIMAGE_INSTANCE_GTK_PIXMAP (pm); |
462 | 250 } |
251 | |
252 style->font = FONT_INSTANCE_GTK_FONT (XFONT_INSTANCE (font)); | |
253 | |
254 return (style); | |
255 } | |
256 | |
257 static Lisp_Object | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4709
diff
changeset
|
258 gdk_event_to_emacs_event (GdkEvent *ev) |
462 | 259 { |
1204 | 260 Lisp_Object event = Qnil; |
462 | 261 |
262 if (ev) | |
263 { | |
1204 | 264 Lisp_Event *emacs_event; |
265 | |
266 event = Fmake_event (Qnil, Qnil); | |
267 emacs_event = XEVENT (event); | |
268 | |
269 if (!gtk_event_to_emacs_event (NULL, ev, emacs_event)) | |
462 | 270 { |
271 /* We need to handle a few more cases than the normal event | |
272 ** loop does. Mainly the double/triple click events. | |
273 */ | |
274 if ((ev->type == GDK_2BUTTON_PRESS) || (ev->type == GDK_3BUTTON_PRESS)) | |
275 { | |
1204 | 276 set_event_type (emacs_event, misc_user_event); |
277 SET_EVENT_MISC_USER_BUTTON (emacs_event, ev->button.button); | |
278 SET_EVENT_MISC_USER_MODIFIERS (emacs_event, 0); | |
2054 | 279 SET_EVENT_MISC_USER_X (emacs_event, (int) ev->button.x); |
280 SET_EVENT_MISC_USER_Y (emacs_event, (int) ev->button.y); | |
462 | 281 if (ev->type == GDK_2BUTTON_PRESS) |
1204 | 282 SET_EVENT_MISC_USER_FUNCTION (emacs_event, intern ("double-click")); |
462 | 283 else |
1204 | 284 SET_EVENT_MISC_USER_FUNCTION (emacs_event, intern ("triple-click")); |
462 | 285 } |
286 else | |
287 { | |
1204 | 288 Fdeallocate_event (event); |
289 event = Qnil; | |
462 | 290 } |
291 } | |
292 } | |
1204 | 293 return (event); |
462 | 294 } |