comparison src/gui_gtk_f.c @ 22659:8623ab39b421 v8.2.1878

patch 8.2.1878: GTK: error for redefining function Commit: https://github.com/vim/vim/commit/8a99e66b4f7616d9b0b9cefe742f82f9122087d5 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Oct 21 16:10:21 2020 +0200 patch 8.2.1878: GTK: error for redefining function Problem: GTK: error for redefining function. (Tony Mechelynck) Solution: Remove "gtk_" prefix from local functions and prepend "gui_" to global functions.
author Bram Moolenaar <Bram@vim.org>
date Wed, 21 Oct 2020 16:15:04 +0200
parents cf8f2fa2c22a
children dd711a44e75b
comparison
equal deleted inserted replaced
22658:05d69fc68432 22659:8623ab39b421
9 9
10 /* 10 /*
11 * (C) 1998,1999 by Marcin Dalecki <martin@dalecki.de> 11 * (C) 1998,1999 by Marcin Dalecki <martin@dalecki.de>
12 * 12 *
13 * Support for GTK+ 2 was added by: 13 * Support for GTK+ 2 was added by:
14 *
15 * (C) 2002,2003 Jason Hildebrand <jason@peaceworks.ca> 14 * (C) 2002,2003 Jason Hildebrand <jason@peaceworks.ca>
16 * Daniel Elstner <daniel.elstner@gmx.net> 15 * Daniel Elstner <daniel.elstner@gmx.net>
17 * 16 *
18 * This is a special purpose container widget, which manages arbitrary 17 * This is a special purpose container widget, which manages arbitrary
19 * children at arbitrary positions width arbitrary sizes. This finally puts 18 * children at arbitrary positions width arbitrary sizes. This finally puts
20 * an end on our resize problems with which we where struggling for such a 19 * an end on our resize problems with which we where struggling for such a
21 * long time. 20 * long time.
22 * 21 *
23 * Support for GTK+ 3 was added by: 22 * Support for GTK+ 3 was added by:
24 *
25 * 2016 Kazunobu Kuriyama <kazunobu.kuriyama@gmail.com> 23 * 2016 Kazunobu Kuriyama <kazunobu.kuriyama@gmail.com>
26 */ 24 */
27 25
28 #include "vim.h" 26 #include "vim.h"
29 #include <gtk/gtk.h> // without this it compiles, but gives errors at 27 #include <gtk/gtk.h> // without this it compiles, but gives errors at
48 gint y; // relative subwidget y position 46 gint y; // relative subwidget y position
49 gint mapped; 47 gint mapped;
50 }; 48 };
51 49
52 50
53 static void gtk_form_class_init(GtkFormClass *klass); 51 static void form_class_init(GtkFormClass *klass);
54 static void gtk_form_init(GtkForm *form, void *g_class); 52 static void form_init(GtkForm *form, void *g_class);
55 53
56 static void gtk_form_realize(GtkWidget *widget); 54 static void form_realize(GtkWidget *widget);
57 static void gtk_form_unrealize(GtkWidget *widget); 55 static void form_unrealize(GtkWidget *widget);
58 static void gtk_form_map(GtkWidget *widget); 56 static void form_map(GtkWidget *widget);
59 static void gtk_form_size_request(GtkWidget *widget, 57 static void form_size_request(GtkWidget *widget, GtkRequisition *requisition);
60 GtkRequisition *requisition); 58 #if GTK_CHECK_VERSION(3,0,0)
61 #if GTK_CHECK_VERSION(3,0,0) 59 static void form_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width);
62 static void gtk_form_get_preferred_width(GtkWidget *widget, 60 static void form_get_preferred_height(GtkWidget *widget, gint *minimal_height, gint *natural_height);
63 gint *minimal_width, 61 #endif
64 gint *natural_width); 62 static void form_size_allocate(GtkWidget *widget, GtkAllocation *allocation);
65 static void gtk_form_get_preferred_height(GtkWidget *widget, 63 #if GTK_CHECK_VERSION(3,0,0)
66 gint *minimal_height, 64 static gboolean form_draw(GtkWidget *widget, cairo_t *cr);
67 gint *natural_height); 65 #else
68 #endif 66 static gint form_expose(GtkWidget *widget, GdkEventExpose *event);
69 static void gtk_form_size_allocate(GtkWidget *widget, 67 #endif
70 GtkAllocation *allocation); 68
71 #if GTK_CHECK_VERSION(3,0,0) 69 static void form_remove(GtkContainer *container, GtkWidget *widget);
72 static gboolean gtk_form_draw(GtkWidget *widget, 70 static void form_forall(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data);
73 cairo_t *cr); 71
74 #else 72 static void form_attach_child_window(GtkForm *form, GtkFormChild *child);
75 static gint gtk_form_expose(GtkWidget *widget, 73 static void form_realize_child(GtkForm *form, GtkFormChild *child);
76 GdkEventExpose *event); 74 static void form_position_child(GtkForm *form, GtkFormChild *child, gboolean force_allocate);
77 #endif 75 static void form_position_children(GtkForm *form);
78 76
79 static void gtk_form_remove(GtkContainer *container, 77 static void form_send_configure(GtkForm *form);
80 GtkWidget *widget); 78
81 static void gtk_form_forall(GtkContainer *container, 79 static void form_child_map(GtkWidget *widget, gpointer user_data);
82 gboolean include_internals, 80 static void form_child_unmap(GtkWidget *widget, gpointer user_data);
83 GtkCallback callback,
84 gpointer callback_data);
85
86 static void gtk_form_attach_child_window(GtkForm *form,
87 GtkFormChild *child);
88 static void gtk_form_realize_child(GtkForm *form,
89 GtkFormChild *child);
90 static void gtk_form_position_child(GtkForm *form,
91 GtkFormChild *child,
92 gboolean force_allocate);
93 static void gtk_form_position_children(GtkForm *form);
94
95 static void gtk_form_send_configure(GtkForm *form);
96
97 static void gtk_form_child_map(GtkWidget *widget, gpointer user_data);
98 static void gtk_form_child_unmap(GtkWidget *widget, gpointer user_data);
99 81
100 #if !GTK_CHECK_VERSION(3,0,0) 82 #if !GTK_CHECK_VERSION(3,0,0)
101 static GtkWidgetClass *parent_class = NULL; 83 static GtkWidgetClass *parent_class = NULL;
102 #endif 84 #endif
103 85
104 // Public interface 86 // Public interface
105 87
106 GtkWidget * 88 GtkWidget *
107 gtk_form_new(void) 89 gui_gtk_form_new(void)
108 { 90 {
109 GtkForm *form; 91 GtkForm *form;
110 92
111 #if GTK_CHECK_VERSION(3,0,0) 93 #if GTK_CHECK_VERSION(3,0,0)
112 form = g_object_new(GTK_TYPE_FORM, NULL); 94 form = g_object_new(GTK_TYPE_FORM, NULL);
113 #else 95 #else
114 form = gtk_type_new(gtk_form_get_type()); 96 form = gtk_type_new(gui_gtk_form_get_type());
115 #endif 97 #endif
116 98
117 return GTK_WIDGET(form); 99 return GTK_WIDGET(form);
118 } 100 }
119 101
120 void 102 void
121 gtk_form_put(GtkForm *form, 103 gui_gtk_form_put(
122 GtkWidget *child_widget, 104 GtkForm *form,
123 gint x, 105 GtkWidget *child_widget,
124 gint y) 106 gint x,
107 gint y)
125 { 108 {
126 GtkFormChild *child; 109 GtkFormChild *child;
127 110
128 g_return_if_fail(GTK_IS_FORM(form)); 111 g_return_if_fail(GTK_IS_FORM(form));
129 112
149 // child->window must be created and attached to the widget _before_ 132 // child->window must be created and attached to the widget _before_
150 // it has been realized, or else things will break with GTK2. Note 133 // it has been realized, or else things will break with GTK2. Note
151 // that gtk_widget_set_parent() realizes the widget if it's visible 134 // that gtk_widget_set_parent() realizes the widget if it's visible
152 // and its parent is mapped. 135 // and its parent is mapped.
153 if (gtk_widget_get_realized(GTK_WIDGET(form))) 136 if (gtk_widget_get_realized(GTK_WIDGET(form)))
154 gtk_form_attach_child_window(form, child); 137 form_attach_child_window(form, child);
155 138
156 gtk_widget_set_parent(child_widget, GTK_WIDGET(form)); 139 gtk_widget_set_parent(child_widget, GTK_WIDGET(form));
157 140
158 if (gtk_widget_get_realized(GTK_WIDGET(form)) 141 if (gtk_widget_get_realized(GTK_WIDGET(form))
159 && !gtk_widget_get_realized(child_widget)) 142 && !gtk_widget_get_realized(child_widget))
160 gtk_form_realize_child(form, child); 143 form_realize_child(form, child);
161 144
162 gtk_form_position_child(form, child, TRUE); 145 form_position_child(form, child, TRUE);
163 } 146 }
164 147
165 void 148 void
166 gtk_form_move(GtkForm *form, 149 gui_gtk_form_move(
167 GtkWidget *child_widget, 150 GtkForm *form,
168 gint x, 151 GtkWidget *child_widget,
169 gint y) 152 gint x,
153 gint y)
170 { 154 {
171 GList *tmp_list; 155 GList *tmp_list;
172 GtkFormChild *child; 156 GtkFormChild *child;
173 157
174 g_return_if_fail(GTK_IS_FORM(form)); 158 g_return_if_fail(GTK_IS_FORM(form));
179 if (child->widget == child_widget) 163 if (child->widget == child_widget)
180 { 164 {
181 child->x = x; 165 child->x = x;
182 child->y = y; 166 child->y = y;
183 167
184 gtk_form_position_child(form, child, TRUE); 168 form_position_child(form, child, TRUE);
185 return; 169 return;
186 } 170 }
187 } 171 }
188 } 172 }
189 173
190 void 174 void
191 gtk_form_freeze(GtkForm *form) 175 gui_gtk_form_freeze(GtkForm *form)
192 { 176 {
193 g_return_if_fail(GTK_IS_FORM(form)); 177 g_return_if_fail(GTK_IS_FORM(form));
194 178
195 ++form->freeze_count; 179 ++form->freeze_count;
196 } 180 }
197 181
198 void 182 void
199 gtk_form_thaw(GtkForm *form) 183 gui_gtk_form_thaw(GtkForm *form)
200 { 184 {
201 g_return_if_fail(GTK_IS_FORM(form)); 185 g_return_if_fail(GTK_IS_FORM(form));
202 186
203 if (form->freeze_count) 187 if (form->freeze_count)
204 { 188 {
205 if (!(--form->freeze_count)) 189 if (!(--form->freeze_count))
206 { 190 {
207 gtk_form_position_children(form); 191 form_position_children(form);
208 gtk_widget_queue_draw(GTK_WIDGET(form)); 192 gtk_widget_queue_draw(GTK_WIDGET(form));
209 } 193 }
210 } 194 }
211 } 195 }
212 196
213 // Basic Object handling procedures 197 // Basic Object handling procedures
214 #if GTK_CHECK_VERSION(3,0,0) 198 #if GTK_CHECK_VERSION(3,0,0)
215 G_DEFINE_TYPE(GtkForm, gtk_form, GTK_TYPE_CONTAINER) 199 G_DEFINE_TYPE(GtkForm, gtk_form, GTK_TYPE_CONTAINER)
216 #else 200 #else
217 GtkType 201 GtkType
218 gtk_form_get_type(void) 202 gui_gtk_form_get_type(void)
219 { 203 {
220 static GtkType form_type = 0; 204 static GtkType form_type = 0;
221 205
222 if (!form_type) 206 if (!form_type)
223 { 207 {
225 209
226 CLEAR_FIELD(form_info); 210 CLEAR_FIELD(form_info);
227 form_info.type_name = "GtkForm"; 211 form_info.type_name = "GtkForm";
228 form_info.object_size = sizeof(GtkForm); 212 form_info.object_size = sizeof(GtkForm);
229 form_info.class_size = sizeof(GtkFormClass); 213 form_info.class_size = sizeof(GtkFormClass);
230 form_info.class_init_func = (GtkClassInitFunc)gtk_form_class_init; 214 form_info.class_init_func = (GtkClassInitFunc)form_class_init;
231 form_info.object_init_func = (GtkObjectInitFunc)gtk_form_init; 215 form_info.object_init_func = (GtkObjectInitFunc)form_init;
232 216
233 form_type = gtk_type_unique(GTK_TYPE_CONTAINER, &form_info); 217 form_type = gtk_type_unique(GTK_TYPE_CONTAINER, &form_info);
234 } 218 }
235 return form_type; 219 return form_type;
236 } 220 }
237 #endif // !GTK_CHECK_VERSION(3,0,0) 221 #endif // !GTK_CHECK_VERSION(3,0,0)
238 222
239 static void 223 static void
240 gtk_form_class_init(GtkFormClass *klass) 224 form_class_init(GtkFormClass *klass)
241 { 225 {
242 GtkWidgetClass *widget_class; 226 GtkWidgetClass *widget_class;
243 GtkContainerClass *container_class; 227 GtkContainerClass *container_class;
244 228
245 widget_class = (GtkWidgetClass *) klass; 229 widget_class = (GtkWidgetClass *) klass;
247 231
248 #if !GTK_CHECK_VERSION(3,0,0) 232 #if !GTK_CHECK_VERSION(3,0,0)
249 parent_class = gtk_type_class(gtk_container_get_type()); 233 parent_class = gtk_type_class(gtk_container_get_type());
250 #endif 234 #endif
251 235
252 widget_class->realize = gtk_form_realize; 236 widget_class->realize = form_realize;
253 widget_class->unrealize = gtk_form_unrealize; 237 widget_class->unrealize = form_unrealize;
254 widget_class->map = gtk_form_map; 238 widget_class->map = form_map;
255 #if GTK_CHECK_VERSION(3,0,0) 239 #if GTK_CHECK_VERSION(3,0,0)
256 widget_class->get_preferred_width = gtk_form_get_preferred_width; 240 widget_class->get_preferred_width = form_get_preferred_width;
257 widget_class->get_preferred_height = gtk_form_get_preferred_height; 241 widget_class->get_preferred_height = form_get_preferred_height;
258 #else 242 #else
259 widget_class->size_request = gtk_form_size_request; 243 widget_class->size_request = form_size_request;
260 #endif 244 #endif
261 widget_class->size_allocate = gtk_form_size_allocate; 245 widget_class->size_allocate = form_size_allocate;
262 #if GTK_CHECK_VERSION(3,0,0) 246 #if GTK_CHECK_VERSION(3,0,0)
263 widget_class->draw = gtk_form_draw; 247 widget_class->draw = form_draw;
264 #else 248 #else
265 widget_class->expose_event = gtk_form_expose; 249 widget_class->expose_event = form_expose;
266 #endif 250 #endif
267 251
268 container_class->remove = gtk_form_remove; 252 container_class->remove = form_remove;
269 container_class->forall = gtk_form_forall; 253 container_class->forall = form_forall;
270 } 254 }
271 255
272 static void 256 static void
273 gtk_form_init(GtkForm *form, void *g_class UNUSED) 257 form_init(GtkForm *form, void *g_class UNUSED)
274 { 258 {
275 #if GTK_CHECK_VERSION(3,0,0) 259 #if GTK_CHECK_VERSION(3,0,0)
276 gtk_widget_set_has_window(GTK_WIDGET(form), TRUE); 260 gtk_widget_set_has_window(GTK_WIDGET(form), TRUE);
277 #endif 261 #endif
278 form->children = NULL; 262 form->children = NULL;
283 /* 267 /*
284 * Widget methods 268 * Widget methods
285 */ 269 */
286 270
287 static void 271 static void
288 gtk_form_realize(GtkWidget *widget) 272 form_realize(GtkWidget *widget)
289 { 273 {
290 GList *tmp_list; 274 GList *tmp_list;
291 GtkForm *form; 275 GtkForm *form;
292 GdkWindowAttr attributes; 276 GdkWindowAttr attributes;
293 gint attributes_mask; 277 gint attributes_mask;
351 335
352 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) 336 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next)
353 { 337 {
354 GtkFormChild *child = tmp_list->data; 338 GtkFormChild *child = tmp_list->data;
355 339
356 gtk_form_attach_child_window(form, child); 340 form_attach_child_window(form, child);
357 341
358 if (gtk_widget_get_visible(child->widget)) 342 if (gtk_widget_get_visible(child->widget))
359 gtk_form_realize_child(form, child); 343 form_realize_child(form, child);
360 } 344 }
361 } 345 }
362 346
363 347
364 // After reading the documentation at 348 // After reading the documentation at
367 // against gtk-2.0. It doesn't seem to cause problems, though. 351 // against gtk-2.0. It doesn't seem to cause problems, though.
368 // 352 //
369 // Well, I reckon at least the gdk_window_show(form->bin_window) 353 // Well, I reckon at least the gdk_window_show(form->bin_window)
370 // is necessary. GtkForm is anything but a usual container widget. 354 // is necessary. GtkForm is anything but a usual container widget.
371 static void 355 static void
372 gtk_form_map(GtkWidget *widget) 356 form_map(GtkWidget *widget)
373 { 357 {
374 GList *tmp_list; 358 GList *tmp_list;
375 GtkForm *form; 359 GtkForm *form;
376 360
377 g_return_if_fail(GTK_IS_FORM(widget)); 361 g_return_if_fail(GTK_IS_FORM(widget));
392 gtk_widget_map(child->widget); 376 gtk_widget_map(child->widget);
393 } 377 }
394 } 378 }
395 379
396 static void 380 static void
397 gtk_form_unrealize(GtkWidget *widget) 381 form_unrealize(GtkWidget *widget)
398 { 382 {
399 GList *tmp_list; 383 GList *tmp_list;
400 GtkForm *form; 384 GtkForm *form;
401 385
402 g_return_if_fail(GTK_IS_FORM(widget)); 386 g_return_if_fail(GTK_IS_FORM(widget));
414 GtkFormChild *child = tmp_list->data; 398 GtkFormChild *child = tmp_list->data;
415 399
416 if (child->window != NULL) 400 if (child->window != NULL)
417 { 401 {
418 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), 402 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
419 FUNC2GENERIC(gtk_form_child_map), 403 FUNC2GENERIC(form_child_map),
420 child); 404 child);
421 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), 405 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
422 FUNC2GENERIC(gtk_form_child_unmap), 406 FUNC2GENERIC(form_child_unmap),
423 child); 407 child);
424 408
425 gdk_window_set_user_data(child->window, NULL); 409 gdk_window_set_user_data(child->window, NULL);
426 gdk_window_destroy(child->window); 410 gdk_window_destroy(child->window);
427 411
439 (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); 423 (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
440 #endif 424 #endif
441 } 425 }
442 426
443 static void 427 static void
444 gtk_form_size_request(GtkWidget *widget, GtkRequisition *requisition) 428 form_size_request(GtkWidget *widget, GtkRequisition *requisition)
445 { 429 {
446 g_return_if_fail(GTK_IS_FORM(widget)); 430 g_return_if_fail(GTK_IS_FORM(widget));
447 g_return_if_fail(requisition != NULL); 431 g_return_if_fail(requisition != NULL);
448 432
449 requisition->width = 1; 433 requisition->width = 1;
450 requisition->height = 1; 434 requisition->height = 1;
451 } 435 }
452 436
453 #if GTK_CHECK_VERSION(3,0,0) 437 #if GTK_CHECK_VERSION(3,0,0)
454 static void 438 static void
455 gtk_form_get_preferred_width(GtkWidget *widget, 439 form_get_preferred_width(GtkWidget *widget,
456 gint *minimal_width, 440 gint *minimal_width,
457 gint *natural_width) 441 gint *natural_width)
458 { 442 {
459 GtkRequisition requisition; 443 GtkRequisition requisition;
460 444
461 gtk_form_size_request(widget, &requisition); 445 form_size_request(widget, &requisition);
462 446
463 *minimal_width = requisition.width; 447 *minimal_width = requisition.width;
464 *natural_width = requisition.width; 448 *natural_width = requisition.width;
465 } 449 }
466 450
467 static void 451 static void
468 gtk_form_get_preferred_height(GtkWidget *widget, 452 form_get_preferred_height(GtkWidget *widget,
469 gint *minimal_height, 453 gint *minimal_height,
470 gint *natural_height) 454 gint *natural_height)
471 { 455 {
472 GtkRequisition requisition; 456 GtkRequisition requisition;
473 457
474 gtk_form_size_request(widget, &requisition); 458 form_size_request(widget, &requisition);
475 459
476 *minimal_height = requisition.height; 460 *minimal_height = requisition.height;
477 *natural_height = requisition.height; 461 *natural_height = requisition.height;
478 } 462 }
479 #endif // GTK_CHECK_VERSION(3,0,0) 463 #endif // GTK_CHECK_VERSION(3,0,0)
480 464
481 static void 465 static void
482 gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation) 466 form_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
483 { 467 {
484 GList *tmp_list; 468 GList *tmp_list;
485 GtkForm *form; 469 GtkForm *form;
486 gboolean need_reposition; 470 gboolean need_reposition;
487 GtkAllocation cur_alloc; 471 GtkAllocation cur_alloc;
505 tmp_list = form->children; 489 tmp_list = form->children;
506 490
507 while (tmp_list) 491 while (tmp_list)
508 { 492 {
509 GtkFormChild *child = tmp_list->data; 493 GtkFormChild *child = tmp_list->data;
510 gtk_form_position_child(form, child, TRUE); 494 form_position_child(form, child, TRUE);
511 495
512 tmp_list = tmp_list->next; 496 tmp_list = tmp_list->next;
513 } 497 }
514 } 498 }
515 499
522 0, 0, 506 0, 0,
523 allocation->width, allocation->height); 507 allocation->width, allocation->height);
524 } 508 }
525 gtk_widget_set_allocation(widget, allocation); 509 gtk_widget_set_allocation(widget, allocation);
526 if (need_reposition) 510 if (need_reposition)
527 gtk_form_send_configure(form); 511 form_send_configure(form);
528 } 512 }
529 513
530 #if GTK_CHECK_VERSION(3,0,0) 514 #if GTK_CHECK_VERSION(3,0,0)
531 static void 515 static void
532 gtk_form_render_background(GtkWidget *widget, cairo_t *cr) 516 gtk_form_render_background(GtkWidget *widget, cairo_t *cr)
536 gtk_widget_get_allocated_width(widget), 520 gtk_widget_get_allocated_width(widget),
537 gtk_widget_get_allocated_height(widget)); 521 gtk_widget_get_allocated_height(widget));
538 } 522 }
539 523
540 static gboolean 524 static gboolean
541 gtk_form_draw(GtkWidget *widget, cairo_t *cr) 525 form_draw(GtkWidget *widget, cairo_t *cr)
542 { 526 {
543 GList *tmp_list = NULL; 527 GList *tmp_list = NULL;
544 GtkForm *form = NULL; 528 GtkForm *form = NULL;
545 529
546 g_return_val_if_fail(GTK_IS_FORM(widget), FALSE); 530 g_return_val_if_fail(GTK_IS_FORM(widget), FALSE);
561 // certain private GtkWidget variable, called 545 // certain private GtkWidget variable, called
562 // widget->priv->alloc_need, to the proper value; otherwise, 546 // widget->priv->alloc_need, to the proper value; otherwise,
563 // gtk_widget_draw() fails and the relevant scrollbar won't 547 // gtk_widget_draw() fails and the relevant scrollbar won't
564 // appear on the screen. 548 // appear on the screen.
565 // 549 //
566 // Calling gtk_form_position_child() like this is one of ways 550 // Calling form_position_child() like this is one of ways
567 // to make sure of that. 551 // to make sure of that.
568 gtk_form_position_child(form, formchild, TRUE); 552 form_position_child(form, formchild, TRUE);
569 553
570 gtk_form_render_background(formchild->widget, cr); 554 gtk_form_render_background(formchild->widget, cr);
571 } 555 }
572 } 556 }
573 557
574 return GTK_WIDGET_CLASS(gtk_form_parent_class)->draw(widget, cr); 558 return GTK_WIDGET_CLASS(gtk_form_parent_class)->draw(widget, cr);
575 } 559 }
576 #else // !GTK_CHECK_VERSION(3,0,0) 560 #else // !GTK_CHECK_VERSION(3,0,0)
577 static gint 561 static gint
578 gtk_form_expose(GtkWidget *widget, GdkEventExpose *event) 562 form_expose(GtkWidget *widget, GdkEventExpose *event)
579 { 563 {
580 GList *tmp_list; 564 GList *tmp_list;
581 GtkForm *form; 565 GtkForm *form;
582 566
583 g_return_val_if_fail(GTK_IS_FORM(widget), FALSE); 567 g_return_val_if_fail(GTK_IS_FORM(widget), FALSE);
596 } 580 }
597 #endif // !GTK_CHECK_VERSION(3,0,0) 581 #endif // !GTK_CHECK_VERSION(3,0,0)
598 582
599 // Container method 583 // Container method
600 static void 584 static void
601 gtk_form_remove(GtkContainer *container, GtkWidget *widget) 585 form_remove(GtkContainer *container, GtkWidget *widget)
602 { 586 {
603 GList *tmp_list; 587 GList *tmp_list;
604 GtkForm *form; 588 GtkForm *form;
605 GtkFormChild *child = NULL; // init for gcc 589 GtkFormChild *child = NULL; // init for gcc
606 590
623 const gboolean was_visible = gtk_widget_get_visible(widget); 607 const gboolean was_visible = gtk_widget_get_visible(widget);
624 #endif 608 #endif
625 if (child->window) 609 if (child->window)
626 { 610 {
627 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), 611 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
628 FUNC2GENERIC(&gtk_form_child_map), child); 612 FUNC2GENERIC(&form_child_map), child);
629 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), 613 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
630 FUNC2GENERIC(&gtk_form_child_unmap), child); 614 FUNC2GENERIC(&form_child_unmap), child);
631 615
632 // FIXME: This will cause problems for reparenting NO_WINDOW 616 // FIXME: This will cause problems for reparenting NO_WINDOW
633 // widgets out of a GtkForm 617 // widgets out of a GtkForm
634 gdk_window_set_user_data(child->window, NULL); 618 gdk_window_set_user_data(child->window, NULL);
635 gdk_window_destroy(child->window); 619 gdk_window_destroy(child->window);
644 g_free(child); 628 g_free(child);
645 } 629 }
646 } 630 }
647 631
648 static void 632 static void
649 gtk_form_forall(GtkContainer *container, 633 form_forall(GtkContainer *container,
650 gboolean include_internals UNUSED, 634 gboolean include_internals UNUSED,
651 GtkCallback callback, 635 GtkCallback callback,
652 gpointer callback_data) 636 gpointer callback_data)
653 { 637 {
654 GtkForm *form; 638 GtkForm *form;
671 } 655 }
672 656
673 // Operations on children 657 // Operations on children
674 658
675 static void 659 static void
676 gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child) 660 form_attach_child_window(GtkForm *form, GtkFormChild *child)
677 { 661 {
678 if (child->window != NULL) 662 if (child->window != NULL)
679 return; // been there, done that 663 return; // been there, done that
680 664
681 if (!gtk_widget_get_has_window(child->widget)) 665 if (!gtk_widget_get_has_window(child->widget))
732 /* 716 /*
733 * Install signal handlers to map/unmap child->window 717 * Install signal handlers to map/unmap child->window
734 * alongside with the actual widget. 718 * alongside with the actual widget.
735 */ 719 */
736 g_signal_connect(G_OBJECT(child->widget), "map", 720 g_signal_connect(G_OBJECT(child->widget), "map",
737 G_CALLBACK(&gtk_form_child_map), child); 721 G_CALLBACK(&form_child_map), child);
738 g_signal_connect(G_OBJECT(child->widget), "unmap", 722 g_signal_connect(G_OBJECT(child->widget), "unmap",
739 G_CALLBACK(&gtk_form_child_unmap), child); 723 G_CALLBACK(&form_child_unmap), child);
740 } 724 }
741 else if (!gtk_widget_get_realized(child->widget)) 725 else if (!gtk_widget_get_realized(child->widget))
742 { 726 {
743 gtk_widget_set_parent_window(child->widget, form->bin_window); 727 gtk_widget_set_parent_window(child->widget, form->bin_window);
744 } 728 }
745 } 729 }
746 730
747 static void 731 static void
748 gtk_form_realize_child(GtkForm *form, GtkFormChild *child) 732 form_realize_child(GtkForm *form, GtkFormChild *child)
749 { 733 {
750 gtk_form_attach_child_window(form, child); 734 form_attach_child_window(form, child);
751 gtk_widget_realize(child->widget); 735 gtk_widget_realize(child->widget);
752 } 736 }
753 737
754 static void 738 static void
755 gtk_form_position_child(GtkForm *form, GtkFormChild *child, 739 form_position_child(GtkForm *form, GtkFormChild *child, gboolean force_allocate)
756 gboolean force_allocate)
757 { 740 {
758 gint x; 741 gint x;
759 gint y; 742 gint y;
760 743
761 x = child->x; 744 x = child->x;
824 } 807 }
825 } 808 }
826 } 809 }
827 810
828 static void 811 static void
829 gtk_form_position_children(GtkForm *form) 812 form_position_children(GtkForm *form)
830 { 813 {
831 GList *tmp_list; 814 GList *tmp_list;
832 815
833 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) 816 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next)
834 gtk_form_position_child(form, tmp_list->data, FALSE); 817 form_position_child(form, tmp_list->data, FALSE);
835 } 818 }
836 819
837 void 820 void
838 gtk_form_move_resize(GtkForm *form, GtkWidget *widget, 821 gui_gtk_form_move_resize(GtkForm *form, GtkWidget *widget,
839 gint x, gint y, gint w, gint h) 822 gint x, gint y, gint w, gint h)
840 { 823 {
841 #if GTK_CHECK_VERSION(3,0,0) 824 #if GTK_CHECK_VERSION(3,0,0)
842 gtk_widget_set_size_request(widget, w, h); 825 gtk_widget_set_size_request(widget, w, h);
843 #else 826 #else
844 widget->requisition.width = w; 827 widget->requisition.width = w;
845 widget->requisition.height = h; 828 widget->requisition.height = h;
846 #endif 829 #endif
847 830
848 gtk_form_move(form, widget, x, y); 831 gui_gtk_form_move(form, widget, x, y);
849 } 832 }
850 833
851 static void 834 static void
852 gtk_form_send_configure(GtkForm *form) 835 form_send_configure(GtkForm *form)
853 { 836 {
854 GtkWidget *widget; 837 GtkWidget *widget;
855 GdkEventConfigure event; 838 GdkEventConfigure event;
856 GtkAllocation allocation; 839 GtkAllocation allocation;
857 840
867 850
868 gtk_main_do_event((GdkEvent*)&event); 851 gtk_main_do_event((GdkEvent*)&event);
869 } 852 }
870 853
871 static void 854 static void
872 gtk_form_child_map(GtkWidget *widget UNUSED, gpointer user_data) 855 form_child_map(GtkWidget *widget UNUSED, gpointer user_data)
873 { 856 {
874 GtkFormChild *child; 857 GtkFormChild *child;
875 858
876 child = (GtkFormChild *)user_data; 859 child = (GtkFormChild *)user_data;
877 860
878 child->mapped = TRUE; 861 child->mapped = TRUE;
879 gdk_window_show(child->window); 862 gdk_window_show(child->window);
880 } 863 }
881 864
882 static void 865 static void
883 gtk_form_child_unmap(GtkWidget *widget UNUSED, gpointer user_data) 866 form_child_unmap(GtkWidget *widget UNUSED, gpointer user_data)
884 { 867 {
885 GtkFormChild *child; 868 GtkFormChild *child;
886 869
887 child = (GtkFormChild *)user_data; 870 child = (GtkFormChild *)user_data;
888 871