comparison src/gui_gtk_f.c @ 8218:3456e2ebebd4 v7.4.1402

commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 23 17:14:37 2016 +0100 patch 7.4.1402 Problem: GTK 3 is not supported. Solution: Add GTK 3 support. (Kazunobu Kuriyama)
author Christian Brabandt <cb@256bit.org>
date Tue, 23 Feb 2016 17:15:05 +0100
parents e4d849f4df03
children 4aead6a9b7a9
comparison
equal deleted inserted replaced
8217:c52abf35df88 8218:3456e2ebebd4
17 * 17 *
18 * This is a special purpose container widget, which manages arbitrary 18 * This is a special purpose container widget, which manages arbitrary
19 * children at arbitrary positions width arbitrary sizes. This finally puts 19 * 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 20 * an end on our resize problems with which we where struggling for such a
21 * long time. 21 * long time.
22 *
23 * Support for GTK+ 3 was added by:
24 *
25 * 2016 Kazunobu Kuriyama <kazunobu.kuriyama@gmail.com>
22 */ 26 */
23 27
24 #include "vim.h" 28 #include "vim.h"
25 #include <gtk/gtk.h> /* without this it compiles, but gives errors at 29 #include <gtk/gtk.h> /* without this it compiles, but gives errors at
26 runtime! */ 30 runtime! */
27 #include "gui_gtk_f.h" 31 #include "gui_gtk_f.h"
28 #include <gtk/gtksignal.h> 32 #if !GTK_CHECK_VERSION(3,0,0)
33 # include <gtk/gtksignal.h>
34 #endif
29 #ifdef WIN3264 35 #ifdef WIN3264
30 # include <gdk/gdkwin32.h> 36 # include <gdk/gdkwin32.h>
31 #else 37 #else
32 # include <gdk/gdkx.h> 38 # include <gdk/gdkx.h>
33 #endif 39 #endif
50 static void gtk_form_realize(GtkWidget *widget); 56 static void gtk_form_realize(GtkWidget *widget);
51 static void gtk_form_unrealize(GtkWidget *widget); 57 static void gtk_form_unrealize(GtkWidget *widget);
52 static void gtk_form_map(GtkWidget *widget); 58 static void gtk_form_map(GtkWidget *widget);
53 static void gtk_form_size_request(GtkWidget *widget, 59 static void gtk_form_size_request(GtkWidget *widget,
54 GtkRequisition *requisition); 60 GtkRequisition *requisition);
61 #if GTK_CHECK_VERSION(3,0,0)
62 static void gtk_form_get_preferred_width(GtkWidget *widget,
63 gint *minimal_width,
64 gint *natural_width);
65 static void gtk_form_get_preferred_height(GtkWidget *widget,
66 gint *minimal_height,
67 gint *natural_height);
68 #endif
55 static void gtk_form_size_allocate(GtkWidget *widget, 69 static void gtk_form_size_allocate(GtkWidget *widget,
56 GtkAllocation *allocation); 70 GtkAllocation *allocation);
71 #if GTK_CHECK_VERSION(3,0,0)
72 static gboolean gtk_form_draw(GtkWidget *widget,
73 cairo_t *cr);
74 #else
57 static gint gtk_form_expose(GtkWidget *widget, 75 static gint gtk_form_expose(GtkWidget *widget,
58 GdkEventExpose *event); 76 GdkEventExpose *event);
77 #endif
59 78
60 static void gtk_form_remove(GtkContainer *container, 79 static void gtk_form_remove(GtkContainer *container,
61 GtkWidget *widget); 80 GtkWidget *widget);
62 static void gtk_form_forall(GtkContainer *container, 81 static void gtk_form_forall(GtkContainer *container,
63 gboolean include_internals, 82 gboolean include_internals,
71 static void gtk_form_position_child(GtkForm *form, 90 static void gtk_form_position_child(GtkForm *form,
72 GtkFormChild *child, 91 GtkFormChild *child,
73 gboolean force_allocate); 92 gboolean force_allocate);
74 static void gtk_form_position_children(GtkForm *form); 93 static void gtk_form_position_children(GtkForm *form);
75 94
95 #if !GTK_CHECK_VERSION(3,0,0)
76 static GdkFilterReturn gtk_form_filter(GdkXEvent *gdk_xevent, 96 static GdkFilterReturn gtk_form_filter(GdkXEvent *gdk_xevent,
77 GdkEvent *event, 97 GdkEvent *event,
78 gpointer data); 98 gpointer data);
79 static GdkFilterReturn gtk_form_main_filter(GdkXEvent *gdk_xevent, 99 static GdkFilterReturn gtk_form_main_filter(GdkXEvent *gdk_xevent,
80 GdkEvent *event, 100 GdkEvent *event,
81 gpointer data); 101 gpointer data);
82 102 #endif
103 #if !GTK_CHECK_VERSION(3,16,0)
83 static void gtk_form_set_static_gravity(GdkWindow *window, 104 static void gtk_form_set_static_gravity(GdkWindow *window,
84 gboolean use_static); 105 gboolean use_static);
106 #endif
85 107
86 static void gtk_form_send_configure(GtkForm *form); 108 static void gtk_form_send_configure(GtkForm *form);
87 109
88 static void gtk_form_child_map(GtkWidget *widget, gpointer user_data); 110 static void gtk_form_child_map(GtkWidget *widget, gpointer user_data);
89 static void gtk_form_child_unmap(GtkWidget *widget, gpointer user_data); 111 static void gtk_form_child_unmap(GtkWidget *widget, gpointer user_data);
90 112
113 #if !GTK_CHECK_VERSION(3,0,0)
91 static GtkWidgetClass *parent_class = NULL; 114 static GtkWidgetClass *parent_class = NULL;
115 #endif
92 116
93 /* Public interface 117 /* Public interface
94 */ 118 */
95 119
96 GtkWidget * 120 GtkWidget *
97 gtk_form_new(void) 121 gtk_form_new(void)
98 { 122 {
99 GtkForm *form; 123 GtkForm *form;
100 124
125 #if GTK_CHECK_VERSION(3,0,0)
126 form = g_object_new(GTK_TYPE_FORM, NULL);
127 #else
101 form = gtk_type_new(gtk_form_get_type()); 128 form = gtk_type_new(gtk_form_get_type());
129 #endif
102 130
103 return GTK_WIDGET(form); 131 return GTK_WIDGET(form);
104 } 132 }
105 133
106 void 134 void
118 146
119 child->widget = child_widget; 147 child->widget = child_widget;
120 child->window = NULL; 148 child->window = NULL;
121 child->x = x; 149 child->x = x;
122 child->y = y; 150 child->y = y;
151 #if GTK_CHECK_VERSION(3,0,0)
152 gtk_widget_set_size_request(child->widget, -1, -1);
153 #else
123 child->widget->requisition.width = 0; 154 child->widget->requisition.width = 0;
124 child->widget->requisition.height = 0; 155 child->widget->requisition.height = 0;
156 #endif
125 child->mapped = FALSE; 157 child->mapped = FALSE;
126 158
127 form->children = g_list_append(form->children, child); 159 form->children = g_list_append(form->children, child);
128 160
129 /* child->window must be created and attached to the widget _before_ 161 /* child->window must be created and attached to the widget _before_
130 * it has been realized, or else things will break with GTK2. Note 162 * it has been realized, or else things will break with GTK2. Note
131 * that gtk_widget_set_parent() realizes the widget if it's visible 163 * that gtk_widget_set_parent() realizes the widget if it's visible
132 * and its parent is mapped. 164 * and its parent is mapped.
133 */ 165 */
166 #if GTK_CHECK_VERSION(3,0,0)
167 if (gtk_widget_get_realized(GTK_WIDGET(form)))
168 #else
134 if (GTK_WIDGET_REALIZED(form)) 169 if (GTK_WIDGET_REALIZED(form))
170 #endif
135 gtk_form_attach_child_window(form, child); 171 gtk_form_attach_child_window(form, child);
136 172
137 gtk_widget_set_parent(child_widget, GTK_WIDGET(form)); 173 gtk_widget_set_parent(child_widget, GTK_WIDGET(form));
174 #if !GTK_CHECK_VERSION(3,0,0)
138 gtk_widget_size_request(child->widget, NULL); 175 gtk_widget_size_request(child->widget, NULL);
139 176 #endif
177
178 #if GTK_CHECK_VERSION(3,0,0)
179 if (gtk_widget_get_realized(GTK_WIDGET(form))
180 && !gtk_widget_get_realized(child_widget))
181 #else
140 if (GTK_WIDGET_REALIZED(form) && !GTK_WIDGET_REALIZED(child_widget)) 182 if (GTK_WIDGET_REALIZED(form) && !GTK_WIDGET_REALIZED(child_widget))
183 #endif
141 gtk_form_realize_child(form, child); 184 gtk_form_realize_child(form, child);
142 185
143 gtk_form_position_child(form, child, TRUE); 186 gtk_form_position_child(form, child, TRUE);
144 } 187 }
145 188
191 } 234 }
192 } 235 }
193 236
194 /* Basic Object handling procedures 237 /* Basic Object handling procedures
195 */ 238 */
239 #if GTK_CHECK_VERSION(3,0,0)
240 G_DEFINE_TYPE(GtkForm, gtk_form, GTK_TYPE_CONTAINER)
241 #else
196 GtkType 242 GtkType
197 gtk_form_get_type(void) 243 gtk_form_get_type(void)
198 { 244 {
199 static GtkType form_type = 0; 245 static GtkType form_type = 0;
200 246
211 257
212 form_type = gtk_type_unique(GTK_TYPE_CONTAINER, &form_info); 258 form_type = gtk_type_unique(GTK_TYPE_CONTAINER, &form_info);
213 } 259 }
214 return form_type; 260 return form_type;
215 } 261 }
262 #endif /* !GTK_CHECK_VERSION(3,0,0) */
216 263
217 static void 264 static void
218 gtk_form_class_init(GtkFormClass *klass) 265 gtk_form_class_init(GtkFormClass *klass)
219 { 266 {
220 GtkWidgetClass *widget_class; 267 GtkWidgetClass *widget_class;
221 GtkContainerClass *container_class; 268 GtkContainerClass *container_class;
222 269
223 widget_class = (GtkWidgetClass *) klass; 270 widget_class = (GtkWidgetClass *) klass;
224 container_class = (GtkContainerClass *) klass; 271 container_class = (GtkContainerClass *) klass;
225 272
273 #if !GTK_CHECK_VERSION(3,0,0)
226 parent_class = gtk_type_class(gtk_container_get_type()); 274 parent_class = gtk_type_class(gtk_container_get_type());
275 #endif
227 276
228 widget_class->realize = gtk_form_realize; 277 widget_class->realize = gtk_form_realize;
229 widget_class->unrealize = gtk_form_unrealize; 278 widget_class->unrealize = gtk_form_unrealize;
230 widget_class->map = gtk_form_map; 279 widget_class->map = gtk_form_map;
280 #if GTK_CHECK_VERSION(3,0,0)
281 widget_class->get_preferred_width = gtk_form_get_preferred_width;
282 widget_class->get_preferred_height = gtk_form_get_preferred_height;
283 #else
231 widget_class->size_request = gtk_form_size_request; 284 widget_class->size_request = gtk_form_size_request;
285 #endif
232 widget_class->size_allocate = gtk_form_size_allocate; 286 widget_class->size_allocate = gtk_form_size_allocate;
287 #if GTK_CHECK_VERSION(3,0,0)
288 widget_class->draw = gtk_form_draw;
289 #else
233 widget_class->expose_event = gtk_form_expose; 290 widget_class->expose_event = gtk_form_expose;
291 #endif
234 292
235 container_class->remove = gtk_form_remove; 293 container_class->remove = gtk_form_remove;
236 container_class->forall = gtk_form_forall; 294 container_class->forall = gtk_form_forall;
237 } 295 }
238 296
239 static void 297 static void
240 gtk_form_init(GtkForm *form) 298 gtk_form_init(GtkForm *form)
241 { 299 {
300 #if GTK_CHECK_VERSION(3,0,0)
301 gtk_widget_set_has_window(GTK_WIDGET(form), TRUE);
302 #endif
242 form->children = NULL; 303 form->children = NULL;
243 304
305 #if !GTK_CHECK_VERSION(3,0,0)
244 form->width = 1; 306 form->width = 1;
245 form->height = 1; 307 form->height = 1;
308 #endif
246 309
247 form->bin_window = NULL; 310 form->bin_window = NULL;
248 311
312 #if !GTK_CHECK_VERSION(3,0,0)
249 form->configure_serial = 0; 313 form->configure_serial = 0;
250 form->visibility = GDK_VISIBILITY_PARTIAL; 314 form->visibility = GDK_VISIBILITY_PARTIAL;
315 #endif
251 316
252 form->freeze_count = 0; 317 form->freeze_count = 0;
253 } 318 }
254 319
255 /* 320 /*
265 gint attributes_mask; 330 gint attributes_mask;
266 331
267 g_return_if_fail(GTK_IS_FORM(widget)); 332 g_return_if_fail(GTK_IS_FORM(widget));
268 333
269 form = GTK_FORM(widget); 334 form = GTK_FORM(widget);
335 #if GTK_CHECK_VERSION(3,0,0)
336 gtk_widget_set_realized(widget, TRUE);
337 #else
270 GTK_WIDGET_SET_FLAGS(form, GTK_REALIZED); 338 GTK_WIDGET_SET_FLAGS(form, GTK_REALIZED);
339 #endif
271 340
272 attributes.window_type = GDK_WINDOW_CHILD; 341 attributes.window_type = GDK_WINDOW_CHILD;
342 #if GTK_CHECK_VERSION(3,0,0)
343 {
344 GtkAllocation allocation;
345 gtk_widget_get_allocation(widget, &allocation);
346 attributes.x = allocation.x;
347 attributes.y = allocation.y;
348 attributes.width = allocation.width;
349 attributes.height = allocation.height;
350 }
351 #else
273 attributes.x = widget->allocation.x; 352 attributes.x = widget->allocation.x;
274 attributes.y = widget->allocation.y; 353 attributes.y = widget->allocation.y;
275 attributes.width = widget->allocation.width; 354 attributes.width = widget->allocation.width;
276 attributes.height = widget->allocation.height; 355 attributes.height = widget->allocation.height;
356 #endif
277 attributes.wclass = GDK_INPUT_OUTPUT; 357 attributes.wclass = GDK_INPUT_OUTPUT;
278 attributes.visual = gtk_widget_get_visual(widget); 358 attributes.visual = gtk_widget_get_visual(widget);
359 #if GTK_CHECK_VERSION(3,0,0)
360 attributes.event_mask = GDK_EXPOSURE_MASK;
361 #else
279 attributes.colormap = gtk_widget_get_colormap(widget); 362 attributes.colormap = gtk_widget_get_colormap(widget);
280 attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK; 363 attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK;
281 364 #endif
365
366 #if GTK_CHECK_VERSION(3,0,0)
367 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
368 #else
282 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; 369 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
283 370 #endif
371
372 #if GTK_CHECK_VERSION(3,0,0)
373 gtk_widget_set_window(widget,
374 gdk_window_new(gtk_widget_get_parent_window(widget),
375 &attributes, attributes_mask));
376 gdk_window_set_user_data(gtk_widget_get_window(widget), widget);
377 #else
284 widget->window = gdk_window_new(gtk_widget_get_parent_window(widget), 378 widget->window = gdk_window_new(gtk_widget_get_parent_window(widget),
285 &attributes, attributes_mask); 379 &attributes, attributes_mask);
286 gdk_window_set_user_data(widget->window, widget); 380 gdk_window_set_user_data(widget->window, widget);
381 #endif
287 382
288 attributes.x = 0; 383 attributes.x = 0;
289 attributes.y = 0; 384 attributes.y = 0;
290 attributes.event_mask = gtk_widget_get_events(widget); 385 attributes.event_mask = gtk_widget_get_events(widget);
291 386
387 #if GTK_CHECK_VERSION(3,0,0)
388 form->bin_window = gdk_window_new(gtk_widget_get_window(widget),
389 &attributes, attributes_mask);
390 #else
292 form->bin_window = gdk_window_new(widget->window, 391 form->bin_window = gdk_window_new(widget->window,
293 &attributes, attributes_mask); 392 &attributes, attributes_mask);
393 #endif
294 gdk_window_set_user_data(form->bin_window, widget); 394 gdk_window_set_user_data(form->bin_window, widget);
295 395
396 #if !GTK_CHECK_VERSION(3,16,0)
296 gtk_form_set_static_gravity(form->bin_window, TRUE); 397 gtk_form_set_static_gravity(form->bin_window, TRUE);
297 398 #endif
399
400 #if GTK_CHECK_VERSION(3,0,0)
401 {
402 GtkStyleContext * const sctx = gtk_widget_get_style_context(widget);
403
404 gtk_style_context_add_class(sctx, "gtk-form");
405 gtk_style_context_set_state(sctx, GTK_STATE_FLAG_NORMAL);
406 # if !GTK_CHECK_VERSION(3,18,0)
407 gtk_style_context_set_background(sctx, gtk_widget_get_window(widget));
408 gtk_style_context_set_background(sctx, form->bin_window);
409 # endif
410 }
411 #else
298 widget->style = gtk_style_attach(widget->style, widget->window); 412 widget->style = gtk_style_attach(widget->style, widget->window);
299 gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL); 413 gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL);
300 gtk_style_set_background(widget->style, form->bin_window, GTK_STATE_NORMAL); 414 gtk_style_set_background(widget->style, form->bin_window, GTK_STATE_NORMAL);
301 415 #endif
416
417 #if !GTK_CHECK_VERSION(3,0,0)
302 gdk_window_add_filter(widget->window, gtk_form_main_filter, form); 418 gdk_window_add_filter(widget->window, gtk_form_main_filter, form);
303 gdk_window_add_filter(form->bin_window, gtk_form_filter, form); 419 gdk_window_add_filter(form->bin_window, gtk_form_filter, form);
420 #endif
304 421
305 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) 422 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next)
306 { 423 {
307 GtkFormChild *child = tmp_list->data; 424 GtkFormChild *child = tmp_list->data;
308 425
309 gtk_form_attach_child_window(form, child); 426 gtk_form_attach_child_window(form, child);
310 427
428 #if GTK_CHECK_VERSION(3,0,0)
429 if (gtk_widget_get_visible(child->widget))
430 #else
311 if (GTK_WIDGET_VISIBLE(child->widget)) 431 if (GTK_WIDGET_VISIBLE(child->widget))
432 #endif
312 gtk_form_realize_child(form, child); 433 gtk_form_realize_child(form, child);
313 } 434 }
314 } 435 }
315 436
316 437
330 451
331 g_return_if_fail(GTK_IS_FORM(widget)); 452 g_return_if_fail(GTK_IS_FORM(widget));
332 453
333 form = GTK_FORM(widget); 454 form = GTK_FORM(widget);
334 455
456 #if GTK_CHECK_VERSION(3,0,0)
457 gtk_widget_set_mapped(widget, TRUE);
458 #else
335 GTK_WIDGET_SET_FLAGS(widget, GTK_MAPPED); 459 GTK_WIDGET_SET_FLAGS(widget, GTK_MAPPED);
336 460 #endif
461
462 #if GTK_CHECK_VERSION(3,0,0)
463 gdk_window_show(gtk_widget_get_window(widget));
464 #else
337 gdk_window_show(widget->window); 465 gdk_window_show(widget->window);
466 #endif
338 gdk_window_show(form->bin_window); 467 gdk_window_show(form->bin_window);
339 468
340 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) 469 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next)
341 { 470 {
342 GtkFormChild *child = tmp_list->data; 471 GtkFormChild *child = tmp_list->data;
343 472
473 #if GTK_CHECK_VERSION(3,0,0)
474 if (gtk_widget_get_visible(child->widget)
475 && !gtk_widget_get_mapped(child->widget))
476 #else
344 if (GTK_WIDGET_VISIBLE(child->widget) 477 if (GTK_WIDGET_VISIBLE(child->widget)
345 && !GTK_WIDGET_MAPPED(child->widget)) 478 && !GTK_WIDGET_MAPPED(child->widget))
479 #endif
346 gtk_widget_map(child->widget); 480 gtk_widget_map(child->widget);
347 } 481 }
348 } 482 }
349 483
350 static void 484 static void
367 { 501 {
368 GtkFormChild *child = tmp_list->data; 502 GtkFormChild *child = tmp_list->data;
369 503
370 if (child->window != NULL) 504 if (child->window != NULL)
371 { 505 {
506 #if GTK_CHECK_VERSION(3,0,0)
507 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
508 G_CALLBACK(gtk_form_child_map),
509 child);
510 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
511 G_CALLBACK(gtk_form_child_unmap),
512 child);
513 #else
372 gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), 514 gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget),
373 GTK_SIGNAL_FUNC(gtk_form_child_map), 515 GTK_SIGNAL_FUNC(gtk_form_child_map),
374 child); 516 child);
375 gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), 517 gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget),
376 GTK_SIGNAL_FUNC(gtk_form_child_unmap), 518 GTK_SIGNAL_FUNC(gtk_form_child_unmap),
377 child); 519 child);
520 #endif
378 521
379 gdk_window_set_user_data(child->window, NULL); 522 gdk_window_set_user_data(child->window, NULL);
380 gdk_window_destroy(child->window); 523 gdk_window_destroy(child->window);
381 524
382 child->window = NULL; 525 child->window = NULL;
383 } 526 }
384 527
385 tmp_list = tmp_list->next; 528 tmp_list = tmp_list->next;
386 } 529 }
387 530
531 #if GTK_CHECK_VERSION(3,0,0)
532 if (GTK_WIDGET_CLASS (gtk_form_parent_class)->unrealize)
533 (* GTK_WIDGET_CLASS (gtk_form_parent_class)->unrealize) (widget);
534 #else
388 if (GTK_WIDGET_CLASS (parent_class)->unrealize) 535 if (GTK_WIDGET_CLASS (parent_class)->unrealize)
389 (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); 536 (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
537 #endif
390 } 538 }
391 539
392 static void 540 static void
393 gtk_form_size_request(GtkWidget *widget, GtkRequisition *requisition) 541 gtk_form_size_request(GtkWidget *widget, GtkRequisition *requisition)
394 { 542 {
543 #if !GTK_CHECK_VERSION(3,0,0)
395 GList *tmp_list; 544 GList *tmp_list;
396 GtkForm *form; 545 GtkForm *form;
546 #endif
397 547
398 g_return_if_fail(GTK_IS_FORM(widget)); 548 g_return_if_fail(GTK_IS_FORM(widget));
399 549
550 #if !GTK_CHECK_VERSION(3,0,0)
400 form = GTK_FORM(widget); 551 form = GTK_FORM(widget);
401 552 #endif
553
554 #if GTK_CHECK_VERSION(3,0,0)
555 requisition->width = 1;
556 requisition->height = 1;
557 #else
402 requisition->width = form->width; 558 requisition->width = form->width;
403 requisition->height = form->height; 559 requisition->height = form->height;
404 560
405 tmp_list = form->children; 561 tmp_list = form->children;
406 562
408 { 564 {
409 GtkFormChild *child = tmp_list->data; 565 GtkFormChild *child = tmp_list->data;
410 gtk_widget_size_request(child->widget, NULL); 566 gtk_widget_size_request(child->widget, NULL);
411 tmp_list = tmp_list->next; 567 tmp_list = tmp_list->next;
412 } 568 }
413 } 569 #endif
570 }
571
572 #if GTK_CHECK_VERSION(3,0,0)
573 static void
574 gtk_form_get_preferred_width(GtkWidget *widget,
575 gint *minimal_width,
576 gint *natural_width)
577 {
578 GtkRequisition requisition;
579
580 gtk_form_size_request(widget, &requisition);
581
582 *minimal_width = requisition.width;
583 *natural_width = requisition.width;
584 }
585
586 static void
587 gtk_form_get_preferred_height(GtkWidget *widget,
588 gint *minimal_height,
589 gint *natural_height)
590 {
591 GtkRequisition requisition;
592
593 gtk_form_size_request(widget, &requisition);
594
595 *minimal_height = requisition.height;
596 *natural_height = requisition.height;
597 }
598 #endif /* GTK_CHECK_VERSION(3,0,0) */
414 599
415 static void 600 static void
416 gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation) 601 gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
417 { 602 {
418 GList *tmp_list; 603 GList *tmp_list;
419 GtkForm *form; 604 GtkForm *form;
420 gboolean need_reposition; 605 gboolean need_reposition;
606 #if GTK_CHECK_VERSION(3,0,0)
607 GtkAllocation cur_alloc;
608 #endif
421 609
422 g_return_if_fail(GTK_IS_FORM(widget)); 610 g_return_if_fail(GTK_IS_FORM(widget));
423 611
612 #if GTK_CHECK_VERSION(3,0,0)
613 gtk_widget_get_allocation(widget, &cur_alloc);
614
615 if (cur_alloc.x == allocation->x
616 && cur_alloc.y == allocation->y
617 && cur_alloc.width == allocation->width
618 && cur_alloc.height == allocation->height)
619 #else
424 if (widget->allocation.x == allocation->x 620 if (widget->allocation.x == allocation->x
425 && widget->allocation.y == allocation->y 621 && widget->allocation.y == allocation->y
426 && widget->allocation.width == allocation->width 622 && widget->allocation.width == allocation->width
427 && widget->allocation.height == allocation->height) 623 && widget->allocation.height == allocation->height)
624 #endif
428 return; 625 return;
429 626
627 #if GTK_CHECK_VERSION(3,0,0)
628 need_reposition = cur_alloc.width != allocation->width
629 || cur_alloc.height != allocation->height;
630 #else
430 need_reposition = widget->allocation.width != allocation->width 631 need_reposition = widget->allocation.width != allocation->width
431 || widget->allocation.height != allocation->height; 632 || widget->allocation.height != allocation->height;
633 #endif
432 form = GTK_FORM(widget); 634 form = GTK_FORM(widget);
433 635
434 if (need_reposition) 636 if (need_reposition)
435 { 637 {
436 tmp_list = form->children; 638 tmp_list = form->children;
442 644
443 tmp_list = tmp_list->next; 645 tmp_list = tmp_list->next;
444 } 646 }
445 } 647 }
446 648
649 #if GTK_CHECK_VERSION(3,0,0)
650 if (gtk_widget_get_realized(widget))
651 #else
447 if (GTK_WIDGET_REALIZED(widget)) 652 if (GTK_WIDGET_REALIZED(widget))
448 { 653 #endif
654 {
655 #if GTK_CHECK_VERSION(3,0,0)
656 gdk_window_move_resize(gtk_widget_get_window(widget),
657 allocation->x, allocation->y,
658 allocation->width, allocation->height);
659 #else
449 gdk_window_move_resize(widget->window, 660 gdk_window_move_resize(widget->window,
450 allocation->x, allocation->y, 661 allocation->x, allocation->y,
451 allocation->width, allocation->height); 662 allocation->width, allocation->height);
663 #endif
452 gdk_window_move_resize(GTK_FORM(widget)->bin_window, 664 gdk_window_move_resize(GTK_FORM(widget)->bin_window,
453 0, 0, 665 0, 0,
454 allocation->width, allocation->height); 666 allocation->width, allocation->height);
455 } 667 }
668 #if GTK_CHECK_VERSION(3,0,0)
669 gtk_widget_set_allocation(widget, allocation);
670 #else
456 widget->allocation = *allocation; 671 widget->allocation = *allocation;
672 #endif
457 if (need_reposition) 673 if (need_reposition)
458 gtk_form_send_configure(form); 674 gtk_form_send_configure(form);
459 } 675 }
460 676
677 #if GTK_CHECK_VERSION(3,0,0)
678 static void
679 gtk_form_render_background(GtkWidget *widget, cairo_t *cr)
680 {
681 gtk_render_background(gtk_widget_get_style_context(widget), cr,
682 0, 0,
683 gtk_widget_get_allocated_width(widget),
684 gtk_widget_get_allocated_height(widget));
685 }
686
687 static gboolean
688 gtk_form_draw(GtkWidget *widget, cairo_t *cr)
689 {
690 GList *tmp_list = NULL;
691 GtkForm *form = NULL;
692
693 g_return_val_if_fail(GTK_IS_FORM(widget), FALSE);
694
695 gtk_form_render_background(widget, cr);
696
697 form = GTK_FORM(widget);
698 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next)
699 {
700 GtkFormChild * const formchild = tmp_list->data;
701
702 if (!gtk_widget_get_has_window(formchild->widget) &&
703 gtk_cairo_should_draw_window(cr, formchild->window))
704 {
705 /* To get gtk_widget_draw() to work, it is required to call
706 * gtk_widget_size_allocate() in advance with a well-posed
707 * allocation for a given child widget in order to set a
708 * certain private GtkWidget variable, called
709 * widget->priv->alloc_need, to the proper value; othewise,
710 * gtk_widget_draw() fails and the relevant scrollbar won't
711 * appear on the screen.
712 *
713 * Calling gtk_form_position_child() like this is one of ways
714 * to make sure of that. */
715 gtk_form_position_child(form, formchild, TRUE);
716
717 gtk_form_render_background(formchild->widget, cr);
718 }
719 }
720
721 return GTK_WIDGET_CLASS(gtk_form_parent_class)->draw(widget, cr);
722 }
723 #else /* !GTK_CHECK_VERSION(3,0,0) */
461 static gint 724 static gint
462 gtk_form_expose(GtkWidget *widget, GdkEventExpose *event) 725 gtk_form_expose(GtkWidget *widget, GdkEventExpose *event)
463 { 726 {
464 GList *tmp_list; 727 GList *tmp_list;
465 GtkForm *form; 728 GtkForm *form;
495 } 758 }
496 } 759 }
497 760
498 return FALSE; 761 return FALSE;
499 } 762 }
763 #endif /* !GTK_CHECK_VERSION(3,0,0) */
500 764
501 /* Container method 765 /* Container method
502 */ 766 */
503 static void 767 static void
504 gtk_form_remove(GtkContainer *container, GtkWidget *widget) 768 gtk_form_remove(GtkContainer *container, GtkWidget *widget)
520 tmp_list = tmp_list->next; 784 tmp_list = tmp_list->next;
521 } 785 }
522 786
523 if (tmp_list) 787 if (tmp_list)
524 { 788 {
789 #if GTK_CHECK_VERSION(3,0,0)
790 const gboolean was_visible = gtk_widget_get_visible(widget);
791 #endif
525 if (child->window) 792 if (child->window)
526 { 793 {
794 #if GTK_CHECK_VERSION(3,0,0)
795 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
796 G_CALLBACK(&gtk_form_child_map), child);
797 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
798 G_CALLBACK(&gtk_form_child_unmap), child);
799 #else
527 gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), 800 gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget),
528 GTK_SIGNAL_FUNC(&gtk_form_child_map), child); 801 GTK_SIGNAL_FUNC(&gtk_form_child_map), child);
529 gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), 802 gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget),
530 GTK_SIGNAL_FUNC(&gtk_form_child_unmap), child); 803 GTK_SIGNAL_FUNC(&gtk_form_child_unmap), child);
804 #endif
531 805
532 /* FIXME: This will cause problems for reparenting NO_WINDOW 806 /* FIXME: This will cause problems for reparenting NO_WINDOW
533 * widgets out of a GtkForm 807 * widgets out of a GtkForm
534 */ 808 */
535 gdk_window_set_user_data(child->window, NULL); 809 gdk_window_set_user_data(child->window, NULL);
536 gdk_window_destroy(child->window); 810 gdk_window_destroy(child->window);
537 } 811 }
538 gtk_widget_unparent(widget); 812 gtk_widget_unparent(widget);
539 813 #if GTK_CHECK_VERSION(3,0,0)
814 if (was_visible)
815 gtk_widget_queue_resize(GTK_WIDGET(container));
816 #endif
540 form->children = g_list_remove_link(form->children, tmp_list); 817 form->children = g_list_remove_link(form->children, tmp_list);
541 g_list_free_1(tmp_list); 818 g_list_free_1(tmp_list);
542 g_free(child); 819 g_free(child);
543 } 820 }
544 } 821 }
575 gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child) 852 gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child)
576 { 853 {
577 if (child->window != NULL) 854 if (child->window != NULL)
578 return; /* been there, done that */ 855 return; /* been there, done that */
579 856
857 #if GTK_CHECK_VERSION(3,0,0)
858 if (!gtk_widget_get_has_window(child->widget))
859 #else
580 if (GTK_WIDGET_NO_WINDOW(child->widget)) 860 if (GTK_WIDGET_NO_WINDOW(child->widget))
861 #endif
581 { 862 {
582 GtkWidget *widget; 863 GtkWidget *widget;
583 GdkWindowAttr attributes; 864 GdkWindowAttr attributes;
584 gint attributes_mask; 865 gint attributes_mask;
585 866
586 widget = GTK_WIDGET(form); 867 widget = GTK_WIDGET(form);
587 868
588 attributes.window_type = GDK_WINDOW_CHILD; 869 attributes.window_type = GDK_WINDOW_CHILD;
589 attributes.x = child->x; 870 attributes.x = child->x;
590 attributes.y = child->y; 871 attributes.y = child->y;
872 #if GTK_CHECK_VERSION(3,0,0)
873 {
874 GtkRequisition requisition;
875
876 gtk_widget_get_preferred_size(child->widget, &requisition, NULL);
877
878 attributes.width = requisition.width;
879 attributes.height = requisition.height;
880 }
881 #else
591 attributes.width = child->widget->requisition.width; 882 attributes.width = child->widget->requisition.width;
592 attributes.height = child->widget->requisition.height; 883 attributes.height = child->widget->requisition.height;
884 #endif
593 attributes.wclass = GDK_INPUT_OUTPUT; 885 attributes.wclass = GDK_INPUT_OUTPUT;
594 attributes.visual = gtk_widget_get_visual(widget); 886 attributes.visual = gtk_widget_get_visual(widget);
887 #if !GTK_CHECK_VERSION(3,0,0)
595 attributes.colormap = gtk_widget_get_colormap(widget); 888 attributes.colormap = gtk_widget_get_colormap(widget);
889 #endif
596 attributes.event_mask = GDK_EXPOSURE_MASK; 890 attributes.event_mask = GDK_EXPOSURE_MASK;
597 891
892 #if GTK_CHECK_VERSION(3,0,0)
893 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
894 #else
598 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; 895 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
896 #endif
599 child->window = gdk_window_new(form->bin_window, 897 child->window = gdk_window_new(form->bin_window,
600 &attributes, attributes_mask); 898 &attributes, attributes_mask);
601 gdk_window_set_user_data(child->window, widget); 899 gdk_window_set_user_data(child->window, widget);
602 900
901 #if GTK_CHECK_VERSION(3,0,0)
902 {
903 GtkStyleContext * const sctx = gtk_widget_get_style_context(widget);
904
905 gtk_style_context_set_state(sctx, GTK_STATE_FLAG_NORMAL);
906 # if !GTK_CHECK_VERSION(3,18,0)
907 gtk_style_context_set_background(sctx, child->window);
908 # endif
909 }
910 #else
603 gtk_style_set_background(widget->style, 911 gtk_style_set_background(widget->style,
604 child->window, 912 child->window,
605 GTK_STATE_NORMAL); 913 GTK_STATE_NORMAL);
914 #endif
606 915
607 gtk_widget_set_parent_window(child->widget, child->window); 916 gtk_widget_set_parent_window(child->widget, child->window);
917 #if !GTK_CHECK_VERSION(3,16,0)
608 gtk_form_set_static_gravity(child->window, TRUE); 918 gtk_form_set_static_gravity(child->window, TRUE);
919 #endif
609 /* 920 /*
610 * Install signal handlers to map/unmap child->window 921 * Install signal handlers to map/unmap child->window
611 * alongside with the actual widget. 922 * alongside with the actual widget.
612 */ 923 */
924 #if GTK_CHECK_VERSION(3,0,0)
925 g_signal_connect(G_OBJECT(child->widget), "map",
926 G_CALLBACK(&gtk_form_child_map), child);
927 g_signal_connect(G_OBJECT(child->widget), "unmap",
928 G_CALLBACK(&gtk_form_child_unmap), child);
929 #else
613 gtk_signal_connect(GTK_OBJECT(child->widget), "map", 930 gtk_signal_connect(GTK_OBJECT(child->widget), "map",
614 GTK_SIGNAL_FUNC(&gtk_form_child_map), child); 931 GTK_SIGNAL_FUNC(&gtk_form_child_map), child);
615 gtk_signal_connect(GTK_OBJECT(child->widget), "unmap", 932 gtk_signal_connect(GTK_OBJECT(child->widget), "unmap",
616 GTK_SIGNAL_FUNC(&gtk_form_child_unmap), child); 933 GTK_SIGNAL_FUNC(&gtk_form_child_unmap), child);
617 } 934 #endif
935 }
936 #if GTK_CHECK_VERSION(3,0,0)
937 else if (!gtk_widget_get_realized(child->widget))
938 #else
618 else if (!GTK_WIDGET_REALIZED(child->widget)) 939 else if (!GTK_WIDGET_REALIZED(child->widget))
940 #endif
619 { 941 {
620 gtk_widget_set_parent_window(child->widget, form->bin_window); 942 gtk_widget_set_parent_window(child->widget, form->bin_window);
621 } 943 }
622 } 944 }
623 945
625 gtk_form_realize_child(GtkForm *form, GtkFormChild *child) 947 gtk_form_realize_child(GtkForm *form, GtkFormChild *child)
626 { 948 {
627 gtk_form_attach_child_window(form, child); 949 gtk_form_attach_child_window(form, child);
628 gtk_widget_realize(child->widget); 950 gtk_widget_realize(child->widget);
629 951
952 #if !GTK_CHECK_VERSION(3,16,0)
630 if (child->window == NULL) /* might be already set, see above */ 953 if (child->window == NULL) /* might be already set, see above */
954 # if GTK_CHECK_VERSION(3,0,0)
955 gtk_form_set_static_gravity(gtk_widget_get_window(child->widget), TRUE);
956 # else
631 gtk_form_set_static_gravity(child->widget->window, TRUE); 957 gtk_form_set_static_gravity(child->widget->window, TRUE);
958 # endif
959 #endif
632 } 960 }
633 961
634 static void 962 static void
635 gtk_form_position_child(GtkForm *form, GtkFormChild *child, 963 gtk_form_position_child(GtkForm *form, GtkFormChild *child,
636 gboolean force_allocate) 964 gboolean force_allocate)
644 if ((x >= G_MINSHORT) && (x <= G_MAXSHORT) && 972 if ((x >= G_MINSHORT) && (x <= G_MAXSHORT) &&
645 (y >= G_MINSHORT) && (y <= G_MAXSHORT)) 973 (y >= G_MINSHORT) && (y <= G_MAXSHORT))
646 { 974 {
647 if (!child->mapped) 975 if (!child->mapped)
648 { 976 {
977 #if GTK_CHECK_VERSION(3,0,0)
978 if (gtk_widget_get_mapped(GTK_WIDGET(form))
979 && gtk_widget_get_visible(child->widget))
980 #else
649 if (GTK_WIDGET_MAPPED(form) && GTK_WIDGET_VISIBLE(child->widget)) 981 if (GTK_WIDGET_MAPPED(form) && GTK_WIDGET_VISIBLE(child->widget))
982 #endif
650 { 983 {
984 #if GTK_CHECK_VERSION(3,0,0)
985 if (!gtk_widget_get_mapped(child->widget))
986 #else
651 if (!GTK_WIDGET_MAPPED(child->widget)) 987 if (!GTK_WIDGET_MAPPED(child->widget))
988 #endif
652 gtk_widget_map(child->widget); 989 gtk_widget_map(child->widget);
653 990
654 child->mapped = TRUE; 991 child->mapped = TRUE;
655 force_allocate = TRUE; 992 force_allocate = TRUE;
656 } 993 }
657 } 994 }
658 995
659 if (force_allocate) 996 if (force_allocate)
660 { 997 {
661 GtkAllocation allocation; 998 GtkAllocation allocation;
662 999 #if GTK_CHECK_VERSION(3,0,0)
1000 GtkRequisition requisition;
1001
1002 gtk_widget_get_preferred_size(child->widget, &requisition, NULL);
1003 #endif
1004
1005 #if GTK_CHECK_VERSION(3,0,0)
1006 if (!gtk_widget_get_has_window(child->widget))
1007 #else
663 if (GTK_WIDGET_NO_WINDOW(child->widget)) 1008 if (GTK_WIDGET_NO_WINDOW(child->widget))
1009 #endif
664 { 1010 {
665 if (child->window) 1011 if (child->window)
666 { 1012 {
1013 #if GTK_CHECK_VERSION(3,0,0)
1014 gdk_window_move_resize(child->window,
1015 x, y,
1016 requisition.width,
1017 requisition.height);
1018 #else
667 gdk_window_move_resize(child->window, 1019 gdk_window_move_resize(child->window,
668 x, y, 1020 x, y,
669 child->widget->requisition.width, 1021 child->widget->requisition.width,
670 child->widget->requisition.height); 1022 child->widget->requisition.height);
1023 #endif
671 } 1024 }
672 1025
673 allocation.x = 0; 1026 allocation.x = 0;
674 allocation.y = 0; 1027 allocation.y = 0;
675 } 1028 }
677 { 1030 {
678 allocation.x = x; 1031 allocation.x = x;
679 allocation.y = y; 1032 allocation.y = y;
680 } 1033 }
681 1034
1035 #if GTK_CHECK_VERSION(3,0,0)
1036 allocation.width = requisition.width;
1037 allocation.height = requisition.height;
1038 #else
682 allocation.width = child->widget->requisition.width; 1039 allocation.width = child->widget->requisition.width;
683 allocation.height = child->widget->requisition.height; 1040 allocation.height = child->widget->requisition.height;
1041 #endif
684 1042
685 gtk_widget_size_allocate(child->widget, &allocation); 1043 gtk_widget_size_allocate(child->widget, &allocation);
686 } 1044 }
687 } 1045 }
688 else 1046 else
689 { 1047 {
690 if (child->mapped) 1048 if (child->mapped)
691 { 1049 {
692 child->mapped = FALSE; 1050 child->mapped = FALSE;
693 1051
1052 #if GTK_CHECK_VERSION(3,0,0)
1053 if (gtk_widget_get_mapped(child->widget))
1054 #else
694 if (GTK_WIDGET_MAPPED(child->widget)) 1055 if (GTK_WIDGET_MAPPED(child->widget))
1056 #endif
695 gtk_widget_unmap(child->widget); 1057 gtk_widget_unmap(child->widget);
696 } 1058 }
697 } 1059 }
698 } 1060 }
699 1061
715 * This routine identifies expose events that are generated when 1077 * This routine identifies expose events that are generated when
716 * we've temporarily moved the bin_window_origin, and translates 1078 * we've temporarily moved the bin_window_origin, and translates
717 * them or discards them, depending on whether we are obscured 1079 * them or discards them, depending on whether we are obscured
718 * or not. 1080 * or not.
719 */ 1081 */
1082 #if !GTK_CHECK_VERSION(3,0,0)
720 static GdkFilterReturn 1083 static GdkFilterReturn
721 gtk_form_filter(GdkXEvent *gdk_xevent, GdkEvent *event UNUSED, gpointer data) 1084 gtk_form_filter(GdkXEvent *gdk_xevent, GdkEvent *event UNUSED, gpointer data)
722 { 1085 {
723 XEvent *xevent; 1086 XEvent *xevent;
724 GtkForm *form; 1087 GtkForm *form;
781 1144
782 return GDK_FILTER_REMOVE; 1145 return GDK_FILTER_REMOVE;
783 } 1146 }
784 return GDK_FILTER_CONTINUE; 1147 return GDK_FILTER_CONTINUE;
785 } 1148 }
786 1149 #endif /* !GTK_CHECK_VERSION(3,0,0) */
1150
1151 #if !GTK_CHECK_VERSION(3,16,0)
787 static void 1152 static void
788 gtk_form_set_static_gravity(GdkWindow *window, gboolean use_static) 1153 gtk_form_set_static_gravity(GdkWindow *window, gboolean use_static)
789 { 1154 {
790 /* We don't check if static gravity is actually supported, because it 1155 /* We don't check if static gravity is actually supported, because it
791 * results in an annoying assertion error message. */ 1156 * results in an annoying assertion error message. */
792 gdk_window_set_static_gravities(window, use_static); 1157 gdk_window_set_static_gravities(window, use_static);
793 } 1158 }
1159 #endif /* !GTK_CHECK_VERSION(3,16,0) */
794 1160
795 void 1161 void
796 gtk_form_move_resize(GtkForm *form, GtkWidget *widget, 1162 gtk_form_move_resize(GtkForm *form, GtkWidget *widget,
797 gint x, gint y, gint w, gint h) 1163 gint x, gint y, gint w, gint h)
798 { 1164 {
1165 #if GTK_CHECK_VERSION(3,0,0)
1166 gtk_widget_set_size_request(widget, w, h);
1167 #else
799 widget->requisition.width = w; 1168 widget->requisition.width = w;
800 widget->requisition.height = h; 1169 widget->requisition.height = h;
1170 #endif
801 1171
802 gtk_form_move(form, widget, x, y); 1172 gtk_form_move(form, widget, x, y);
803 } 1173 }
804 1174
805 static void 1175 static void
809 GdkEventConfigure event; 1179 GdkEventConfigure event;
810 1180
811 widget = GTK_WIDGET(form); 1181 widget = GTK_WIDGET(form);
812 1182
813 event.type = GDK_CONFIGURE; 1183 event.type = GDK_CONFIGURE;
1184 #if GTK_CHECK_VERSION(3,0,0)
1185 event.window = gtk_widget_get_window(widget);
1186 {
1187 GtkAllocation allocation;
1188
1189 gtk_widget_get_allocation(widget, &allocation);
1190 event.x = allocation.x;
1191 event.y = allocation.y;
1192 event.width = allocation.width;
1193 event.height = allocation.height;
1194 }
1195 #else
814 event.window = widget->window; 1196 event.window = widget->window;
815 event.x = widget->allocation.x; 1197 event.x = widget->allocation.x;
816 event.y = widget->allocation.y; 1198 event.y = widget->allocation.y;
817 event.width = widget->allocation.width; 1199 event.width = widget->allocation.width;
818 event.height = widget->allocation.height; 1200 event.height = widget->allocation.height;
1201 #endif
819 1202
820 gtk_main_do_event((GdkEvent*)&event); 1203 gtk_main_do_event((GdkEvent*)&event);
821 } 1204 }
822 1205
823 static void 1206 static void
839 child = (GtkFormChild *)user_data; 1222 child = (GtkFormChild *)user_data;
840 1223
841 child->mapped = FALSE; 1224 child->mapped = FALSE;
842 gdk_window_hide(child->window); 1225 gdk_window_hide(child->window);
843 } 1226 }
844