Mercurial > vim
comparison src/gui_gtk_f.c @ 14786:11978f68a8c3 v8.1.0405
patch 8.1.0405: too many #ifdefs for GTK
commit https://github.com/vim/vim/commit/664323e7c82c35eabb9056efca0df6cc8d6cfd60
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Sep 18 22:30:07 2018 +0200
patch 8.1.0405: too many #ifdefs for GTK
Problem: Too many #ifdefs for GTK.
Solution: Define macros instead of using #ifdef. (Ken Takata, closes https://github.com/vim/vim/issues/3436)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 18 Sep 2018 22:45:05 +0200 |
parents | 82e7ce311065 |
children | 7fad90423bd2 |
comparison
equal
deleted
inserted
replaced
14785:7f365a30fe7c | 14786:11978f68a8c3 |
---|---|
148 /* child->window must be created and attached to the widget _before_ | 148 /* child->window must be created and attached to the widget _before_ |
149 * it has been realized, or else things will break with GTK2. Note | 149 * it has been realized, or else things will break with GTK2. Note |
150 * that gtk_widget_set_parent() realizes the widget if it's visible | 150 * that gtk_widget_set_parent() realizes the widget if it's visible |
151 * and its parent is mapped. | 151 * and its parent is mapped. |
152 */ | 152 */ |
153 #if GTK_CHECK_VERSION(3,0,0) | |
154 if (gtk_widget_get_realized(GTK_WIDGET(form))) | 153 if (gtk_widget_get_realized(GTK_WIDGET(form))) |
155 #else | |
156 if (GTK_WIDGET_REALIZED(form)) | |
157 #endif | |
158 gtk_form_attach_child_window(form, child); | 154 gtk_form_attach_child_window(form, child); |
159 | 155 |
160 gtk_widget_set_parent(child_widget, GTK_WIDGET(form)); | 156 gtk_widget_set_parent(child_widget, GTK_WIDGET(form)); |
161 | 157 |
162 #if GTK_CHECK_VERSION(3,0,0) | |
163 if (gtk_widget_get_realized(GTK_WIDGET(form)) | 158 if (gtk_widget_get_realized(GTK_WIDGET(form)) |
164 && !gtk_widget_get_realized(child_widget)) | 159 && !gtk_widget_get_realized(child_widget)) |
165 #else | |
166 if (GTK_WIDGET_REALIZED(form) && !GTK_WIDGET_REALIZED(child_widget)) | |
167 #endif | |
168 gtk_form_realize_child(form, child); | 160 gtk_form_realize_child(form, child); |
169 | 161 |
170 gtk_form_position_child(form, child, TRUE); | 162 gtk_form_position_child(form, child, TRUE); |
171 } | 163 } |
172 | 164 |
298 { | 290 { |
299 GList *tmp_list; | 291 GList *tmp_list; |
300 GtkForm *form; | 292 GtkForm *form; |
301 GdkWindowAttr attributes; | 293 GdkWindowAttr attributes; |
302 gint attributes_mask; | 294 gint attributes_mask; |
295 GtkAllocation allocation; | |
303 | 296 |
304 g_return_if_fail(GTK_IS_FORM(widget)); | 297 g_return_if_fail(GTK_IS_FORM(widget)); |
305 | 298 |
306 form = GTK_FORM(widget); | 299 form = GTK_FORM(widget); |
307 #if GTK_CHECK_VERSION(3,0,0) | |
308 gtk_widget_set_realized(widget, TRUE); | 300 gtk_widget_set_realized(widget, TRUE); |
309 #else | 301 |
310 GTK_WIDGET_SET_FLAGS(form, GTK_REALIZED); | 302 gtk_widget_get_allocation(widget, &allocation); |
311 #endif | |
312 | |
313 attributes.window_type = GDK_WINDOW_CHILD; | 303 attributes.window_type = GDK_WINDOW_CHILD; |
314 #if GTK_CHECK_VERSION(3,0,0) | 304 attributes.x = allocation.x; |
315 { | 305 attributes.y = allocation.y; |
316 GtkAllocation allocation; | 306 attributes.width = allocation.width; |
317 gtk_widget_get_allocation(widget, &allocation); | 307 attributes.height = allocation.height; |
318 attributes.x = allocation.x; | |
319 attributes.y = allocation.y; | |
320 attributes.width = allocation.width; | |
321 attributes.height = allocation.height; | |
322 } | |
323 #else | |
324 attributes.x = widget->allocation.x; | |
325 attributes.y = widget->allocation.y; | |
326 attributes.width = widget->allocation.width; | |
327 attributes.height = widget->allocation.height; | |
328 #endif | |
329 attributes.wclass = GDK_INPUT_OUTPUT; | 308 attributes.wclass = GDK_INPUT_OUTPUT; |
330 attributes.visual = gtk_widget_get_visual(widget); | 309 attributes.visual = gtk_widget_get_visual(widget); |
331 #if GTK_CHECK_VERSION(3,0,0) | 310 #if GTK_CHECK_VERSION(3,0,0) |
332 attributes.event_mask = GDK_EXPOSURE_MASK; | 311 attributes.event_mask = GDK_EXPOSURE_MASK; |
333 #else | 312 #else |
339 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; | 318 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; |
340 #else | 319 #else |
341 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; | 320 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; |
342 #endif | 321 #endif |
343 | 322 |
344 #if GTK_CHECK_VERSION(3,0,0) | |
345 gtk_widget_set_window(widget, | 323 gtk_widget_set_window(widget, |
346 gdk_window_new(gtk_widget_get_parent_window(widget), | 324 gdk_window_new(gtk_widget_get_parent_window(widget), |
347 &attributes, attributes_mask)); | 325 &attributes, attributes_mask)); |
348 #else | |
349 widget->window = gdk_window_new(gtk_widget_get_parent_window(widget), | |
350 &attributes, attributes_mask); | |
351 #endif | |
352 gdk_window_set_user_data(gtk_widget_get_window(widget), widget); | 326 gdk_window_set_user_data(gtk_widget_get_window(widget), widget); |
353 | 327 |
354 attributes.x = 0; | 328 attributes.x = 0; |
355 attributes.y = 0; | 329 attributes.y = 0; |
356 attributes.event_mask = gtk_widget_get_events(widget); | 330 attributes.event_mask = gtk_widget_get_events(widget); |
380 { | 354 { |
381 GtkFormChild *child = tmp_list->data; | 355 GtkFormChild *child = tmp_list->data; |
382 | 356 |
383 gtk_form_attach_child_window(form, child); | 357 gtk_form_attach_child_window(form, child); |
384 | 358 |
385 #if GTK_CHECK_VERSION(3,0,0) | |
386 if (gtk_widget_get_visible(child->widget)) | 359 if (gtk_widget_get_visible(child->widget)) |
387 #else | |
388 if (GTK_WIDGET_VISIBLE(child->widget)) | |
389 #endif | |
390 gtk_form_realize_child(form, child); | 360 gtk_form_realize_child(form, child); |
391 } | 361 } |
392 } | 362 } |
393 | 363 |
394 | 364 |
408 | 378 |
409 g_return_if_fail(GTK_IS_FORM(widget)); | 379 g_return_if_fail(GTK_IS_FORM(widget)); |
410 | 380 |
411 form = GTK_FORM(widget); | 381 form = GTK_FORM(widget); |
412 | 382 |
413 #if GTK_CHECK_VERSION(3,0,0) | |
414 gtk_widget_set_mapped(widget, TRUE); | 383 gtk_widget_set_mapped(widget, TRUE); |
415 #else | |
416 GTK_WIDGET_SET_FLAGS(widget, GTK_MAPPED); | |
417 #endif | |
418 | 384 |
419 gdk_window_show(gtk_widget_get_window(widget)); | 385 gdk_window_show(gtk_widget_get_window(widget)); |
420 gdk_window_show(form->bin_window); | 386 gdk_window_show(form->bin_window); |
421 | 387 |
422 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) | 388 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) |
423 { | 389 { |
424 GtkFormChild *child = tmp_list->data; | 390 GtkFormChild *child = tmp_list->data; |
425 | 391 |
426 #if GTK_CHECK_VERSION(3,0,0) | |
427 if (gtk_widget_get_visible(child->widget) | 392 if (gtk_widget_get_visible(child->widget) |
428 && !gtk_widget_get_mapped(child->widget)) | 393 && !gtk_widget_get_mapped(child->widget)) |
429 #else | |
430 if (GTK_WIDGET_VISIBLE(child->widget) | |
431 && !GTK_WIDGET_MAPPED(child->widget)) | |
432 #endif | |
433 gtk_widget_map(child->widget); | 394 gtk_widget_map(child->widget); |
434 } | 395 } |
435 } | 396 } |
436 | 397 |
437 static void | 398 static void |
454 { | 415 { |
455 GtkFormChild *child = tmp_list->data; | 416 GtkFormChild *child = tmp_list->data; |
456 | 417 |
457 if (child->window != NULL) | 418 if (child->window != NULL) |
458 { | 419 { |
459 #if GTK_CHECK_VERSION(3,0,0) | |
460 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), | 420 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), |
461 FUNC2GENERIC(gtk_form_child_map), | 421 FUNC2GENERIC(gtk_form_child_map), |
462 child); | 422 child); |
463 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), | 423 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), |
464 FUNC2GENERIC(gtk_form_child_unmap), | 424 FUNC2GENERIC(gtk_form_child_unmap), |
465 child); | 425 child); |
466 #else | |
467 gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), | |
468 GTK_SIGNAL_FUNC(gtk_form_child_map), | |
469 child); | |
470 gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), | |
471 GTK_SIGNAL_FUNC(gtk_form_child_unmap), | |
472 child); | |
473 #endif | |
474 | 426 |
475 gdk_window_set_user_data(child->window, NULL); | 427 gdk_window_set_user_data(child->window, NULL); |
476 gdk_window_destroy(child->window); | 428 gdk_window_destroy(child->window); |
477 | 429 |
478 child->window = NULL; | 430 child->window = NULL; |
532 gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation) | 484 gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation) |
533 { | 485 { |
534 GList *tmp_list; | 486 GList *tmp_list; |
535 GtkForm *form; | 487 GtkForm *form; |
536 gboolean need_reposition; | 488 gboolean need_reposition; |
537 #if GTK_CHECK_VERSION(3,0,0) | |
538 GtkAllocation cur_alloc; | 489 GtkAllocation cur_alloc; |
539 #endif | |
540 | 490 |
541 g_return_if_fail(GTK_IS_FORM(widget)); | 491 g_return_if_fail(GTK_IS_FORM(widget)); |
542 | 492 |
543 #if GTK_CHECK_VERSION(3,0,0) | |
544 gtk_widget_get_allocation(widget, &cur_alloc); | 493 gtk_widget_get_allocation(widget, &cur_alloc); |
545 | 494 |
546 if (cur_alloc.x == allocation->x | 495 if (cur_alloc.x == allocation->x |
547 && cur_alloc.y == allocation->y | 496 && cur_alloc.y == allocation->y |
548 && cur_alloc.width == allocation->width | 497 && cur_alloc.width == allocation->width |
549 && cur_alloc.height == allocation->height) | 498 && cur_alloc.height == allocation->height) |
550 #else | |
551 if (widget->allocation.x == allocation->x | |
552 && widget->allocation.y == allocation->y | |
553 && widget->allocation.width == allocation->width | |
554 && widget->allocation.height == allocation->height) | |
555 #endif | |
556 return; | 499 return; |
557 | 500 |
558 #if GTK_CHECK_VERSION(3,0,0) | |
559 need_reposition = cur_alloc.width != allocation->width | 501 need_reposition = cur_alloc.width != allocation->width |
560 || cur_alloc.height != allocation->height; | 502 || cur_alloc.height != allocation->height; |
561 #else | |
562 need_reposition = widget->allocation.width != allocation->width | |
563 || widget->allocation.height != allocation->height; | |
564 #endif | |
565 form = GTK_FORM(widget); | 503 form = GTK_FORM(widget); |
566 | 504 |
567 if (need_reposition) | 505 if (need_reposition) |
568 { | 506 { |
569 tmp_list = form->children; | 507 tmp_list = form->children; |
575 | 513 |
576 tmp_list = tmp_list->next; | 514 tmp_list = tmp_list->next; |
577 } | 515 } |
578 } | 516 } |
579 | 517 |
580 #if GTK_CHECK_VERSION(3,0,0) | |
581 if (gtk_widget_get_realized(widget)) | 518 if (gtk_widget_get_realized(widget)) |
582 #else | |
583 if (GTK_WIDGET_REALIZED(widget)) | |
584 #endif | |
585 { | 519 { |
586 gdk_window_move_resize(gtk_widget_get_window(widget), | 520 gdk_window_move_resize(gtk_widget_get_window(widget), |
587 allocation->x, allocation->y, | 521 allocation->x, allocation->y, |
588 allocation->width, allocation->height); | 522 allocation->width, allocation->height); |
589 gdk_window_move_resize(GTK_FORM(widget)->bin_window, | 523 gdk_window_move_resize(GTK_FORM(widget)->bin_window, |
590 0, 0, | 524 0, 0, |
591 allocation->width, allocation->height); | 525 allocation->width, allocation->height); |
592 } | 526 } |
593 #if GTK_CHECK_VERSION(3,0,0) | |
594 gtk_widget_set_allocation(widget, allocation); | 527 gtk_widget_set_allocation(widget, allocation); |
595 #else | |
596 widget->allocation = *allocation; | |
597 #endif | |
598 if (need_reposition) | 528 if (need_reposition) |
599 gtk_form_send_configure(form); | 529 gtk_form_send_configure(form); |
600 } | 530 } |
601 | 531 |
602 #if GTK_CHECK_VERSION(3,0,0) | 532 #if GTK_CHECK_VERSION(3,0,0) |
695 #if GTK_CHECK_VERSION(3,0,0) | 625 #if GTK_CHECK_VERSION(3,0,0) |
696 const gboolean was_visible = gtk_widget_get_visible(widget); | 626 const gboolean was_visible = gtk_widget_get_visible(widget); |
697 #endif | 627 #endif |
698 if (child->window) | 628 if (child->window) |
699 { | 629 { |
700 #if GTK_CHECK_VERSION(3,0,0) | |
701 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), | 630 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), |
702 FUNC2GENERIC(>k_form_child_map), child); | 631 FUNC2GENERIC(>k_form_child_map), child); |
703 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), | 632 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), |
704 FUNC2GENERIC(>k_form_child_unmap), child); | 633 FUNC2GENERIC(>k_form_child_unmap), child); |
705 #else | |
706 gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), | |
707 GTK_SIGNAL_FUNC(>k_form_child_map), child); | |
708 gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), | |
709 GTK_SIGNAL_FUNC(>k_form_child_unmap), child); | |
710 #endif | |
711 | 634 |
712 /* FIXME: This will cause problems for reparenting NO_WINDOW | 635 /* FIXME: This will cause problems for reparenting NO_WINDOW |
713 * widgets out of a GtkForm | 636 * widgets out of a GtkForm |
714 */ | 637 */ |
715 gdk_window_set_user_data(child->window, NULL); | 638 gdk_window_set_user_data(child->window, NULL); |
758 gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child) | 681 gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child) |
759 { | 682 { |
760 if (child->window != NULL) | 683 if (child->window != NULL) |
761 return; /* been there, done that */ | 684 return; /* been there, done that */ |
762 | 685 |
763 #if GTK_CHECK_VERSION(3,0,0) | |
764 if (!gtk_widget_get_has_window(child->widget)) | 686 if (!gtk_widget_get_has_window(child->widget)) |
765 #else | |
766 if (GTK_WIDGET_NO_WINDOW(child->widget)) | |
767 #endif | |
768 { | 687 { |
769 GtkWidget *widget; | 688 GtkWidget *widget; |
770 GdkWindowAttr attributes; | 689 GdkWindowAttr attributes; |
771 gint attributes_mask; | 690 gint attributes_mask; |
691 GtkRequisition requisition; | |
772 | 692 |
773 widget = GTK_WIDGET(form); | 693 widget = GTK_WIDGET(form); |
774 | 694 |
695 #if GTK_CHECK_VERSION(3,0,0) | |
696 gtk_widget_get_preferred_size(child->widget, &requisition, NULL); | |
697 #else | |
698 requisition = child->widget->requisition; | |
699 #endif | |
775 attributes.window_type = GDK_WINDOW_CHILD; | 700 attributes.window_type = GDK_WINDOW_CHILD; |
776 attributes.x = child->x; | 701 attributes.x = child->x; |
777 attributes.y = child->y; | 702 attributes.y = child->y; |
778 #if GTK_CHECK_VERSION(3,0,0) | 703 attributes.width = requisition.width; |
779 { | 704 attributes.height = requisition.height; |
780 GtkRequisition requisition; | |
781 | |
782 gtk_widget_get_preferred_size(child->widget, &requisition, NULL); | |
783 | |
784 attributes.width = requisition.width; | |
785 attributes.height = requisition.height; | |
786 } | |
787 #else | |
788 attributes.width = child->widget->requisition.width; | |
789 attributes.height = child->widget->requisition.height; | |
790 #endif | |
791 attributes.wclass = GDK_INPUT_OUTPUT; | 705 attributes.wclass = GDK_INPUT_OUTPUT; |
792 attributes.visual = gtk_widget_get_visual(widget); | 706 attributes.visual = gtk_widget_get_visual(widget); |
793 #if !GTK_CHECK_VERSION(3,0,0) | 707 #if !GTK_CHECK_VERSION(3,0,0) |
794 attributes.colormap = gtk_widget_get_colormap(widget); | 708 attributes.colormap = gtk_widget_get_colormap(widget); |
795 #endif | 709 #endif |
822 gtk_widget_set_parent_window(child->widget, child->window); | 736 gtk_widget_set_parent_window(child->widget, child->window); |
823 /* | 737 /* |
824 * Install signal handlers to map/unmap child->window | 738 * Install signal handlers to map/unmap child->window |
825 * alongside with the actual widget. | 739 * alongside with the actual widget. |
826 */ | 740 */ |
827 #if GTK_CHECK_VERSION(3,0,0) | |
828 g_signal_connect(G_OBJECT(child->widget), "map", | 741 g_signal_connect(G_OBJECT(child->widget), "map", |
829 G_CALLBACK(>k_form_child_map), child); | 742 G_CALLBACK(>k_form_child_map), child); |
830 g_signal_connect(G_OBJECT(child->widget), "unmap", | 743 g_signal_connect(G_OBJECT(child->widget), "unmap", |
831 G_CALLBACK(>k_form_child_unmap), child); | 744 G_CALLBACK(>k_form_child_unmap), child); |
832 #else | 745 } |
833 gtk_signal_connect(GTK_OBJECT(child->widget), "map", | |
834 GTK_SIGNAL_FUNC(>k_form_child_map), child); | |
835 gtk_signal_connect(GTK_OBJECT(child->widget), "unmap", | |
836 GTK_SIGNAL_FUNC(>k_form_child_unmap), child); | |
837 #endif | |
838 } | |
839 #if GTK_CHECK_VERSION(3,0,0) | |
840 else if (!gtk_widget_get_realized(child->widget)) | 746 else if (!gtk_widget_get_realized(child->widget)) |
841 #else | |
842 else if (!GTK_WIDGET_REALIZED(child->widget)) | |
843 #endif | |
844 { | 747 { |
845 gtk_widget_set_parent_window(child->widget, form->bin_window); | 748 gtk_widget_set_parent_window(child->widget, form->bin_window); |
846 } | 749 } |
847 } | 750 } |
848 | 751 |
866 if ((x >= G_MINSHORT) && (x <= G_MAXSHORT) && | 769 if ((x >= G_MINSHORT) && (x <= G_MAXSHORT) && |
867 (y >= G_MINSHORT) && (y <= G_MAXSHORT)) | 770 (y >= G_MINSHORT) && (y <= G_MAXSHORT)) |
868 { | 771 { |
869 if (!child->mapped) | 772 if (!child->mapped) |
870 { | 773 { |
871 #if GTK_CHECK_VERSION(3,0,0) | |
872 if (gtk_widget_get_mapped(GTK_WIDGET(form)) | 774 if (gtk_widget_get_mapped(GTK_WIDGET(form)) |
873 && gtk_widget_get_visible(child->widget)) | 775 && gtk_widget_get_visible(child->widget)) |
874 #else | |
875 if (GTK_WIDGET_MAPPED(form) && GTK_WIDGET_VISIBLE(child->widget)) | |
876 #endif | |
877 { | 776 { |
878 #if GTK_CHECK_VERSION(3,0,0) | |
879 if (!gtk_widget_get_mapped(child->widget)) | 777 if (!gtk_widget_get_mapped(child->widget)) |
880 #else | |
881 if (!GTK_WIDGET_MAPPED(child->widget)) | |
882 #endif | |
883 gtk_widget_map(child->widget); | 778 gtk_widget_map(child->widget); |
884 | 779 |
885 child->mapped = TRUE; | 780 child->mapped = TRUE; |
886 force_allocate = TRUE; | 781 force_allocate = TRUE; |
887 } | 782 } |
888 } | 783 } |
889 | 784 |
890 if (force_allocate) | 785 if (force_allocate) |
891 { | 786 { |
892 GtkAllocation allocation; | 787 GtkAllocation allocation; |
893 #if GTK_CHECK_VERSION(3,0,0) | |
894 GtkRequisition requisition; | 788 GtkRequisition requisition; |
895 | 789 |
790 #if GTK_CHECK_VERSION(3,0,0) | |
896 gtk_widget_get_preferred_size(child->widget, &requisition, NULL); | 791 gtk_widget_get_preferred_size(child->widget, &requisition, NULL); |
897 #endif | 792 #else |
898 | 793 requisition = child->widget->requisition; |
899 #if GTK_CHECK_VERSION(3,0,0) | 794 #endif |
795 | |
900 if (!gtk_widget_get_has_window(child->widget)) | 796 if (!gtk_widget_get_has_window(child->widget)) |
901 #else | |
902 if (GTK_WIDGET_NO_WINDOW(child->widget)) | |
903 #endif | |
904 { | 797 { |
905 if (child->window) | 798 if (child->window) |
906 { | 799 { |
907 #if GTK_CHECK_VERSION(3,0,0) | |
908 gdk_window_move_resize(child->window, | 800 gdk_window_move_resize(child->window, |
909 x, y, | 801 x, y, |
910 requisition.width, | 802 requisition.width, |
911 requisition.height); | 803 requisition.height); |
912 #else | |
913 gdk_window_move_resize(child->window, | |
914 x, y, | |
915 child->widget->requisition.width, | |
916 child->widget->requisition.height); | |
917 #endif | |
918 } | 804 } |
919 | 805 |
920 allocation.x = 0; | 806 allocation.x = 0; |
921 allocation.y = 0; | 807 allocation.y = 0; |
922 } | 808 } |
924 { | 810 { |
925 allocation.x = x; | 811 allocation.x = x; |
926 allocation.y = y; | 812 allocation.y = y; |
927 } | 813 } |
928 | 814 |
929 #if GTK_CHECK_VERSION(3,0,0) | |
930 allocation.width = requisition.width; | 815 allocation.width = requisition.width; |
931 allocation.height = requisition.height; | 816 allocation.height = requisition.height; |
932 #else | |
933 allocation.width = child->widget->requisition.width; | |
934 allocation.height = child->widget->requisition.height; | |
935 #endif | |
936 | 817 |
937 gtk_widget_size_allocate(child->widget, &allocation); | 818 gtk_widget_size_allocate(child->widget, &allocation); |
938 } | 819 } |
939 } | 820 } |
940 else | 821 else |
941 { | 822 { |
942 if (child->mapped) | 823 if (child->mapped) |
943 { | 824 { |
944 child->mapped = FALSE; | 825 child->mapped = FALSE; |
945 | 826 |
946 #if GTK_CHECK_VERSION(3,0,0) | |
947 if (gtk_widget_get_mapped(child->widget)) | 827 if (gtk_widget_get_mapped(child->widget)) |
948 #else | |
949 if (GTK_WIDGET_MAPPED(child->widget)) | |
950 #endif | |
951 gtk_widget_unmap(child->widget); | 828 gtk_widget_unmap(child->widget); |
952 } | 829 } |
953 } | 830 } |
954 } | 831 } |
955 | 832 |
979 static void | 856 static void |
980 gtk_form_send_configure(GtkForm *form) | 857 gtk_form_send_configure(GtkForm *form) |
981 { | 858 { |
982 GtkWidget *widget; | 859 GtkWidget *widget; |
983 GdkEventConfigure event; | 860 GdkEventConfigure event; |
861 GtkAllocation allocation; | |
984 | 862 |
985 widget = GTK_WIDGET(form); | 863 widget = GTK_WIDGET(form); |
986 | 864 |
865 gtk_widget_get_allocation(widget, &allocation); | |
987 event.type = GDK_CONFIGURE; | 866 event.type = GDK_CONFIGURE; |
988 #if GTK_CHECK_VERSION(3,0,0) | |
989 event.window = gtk_widget_get_window(widget); | 867 event.window = gtk_widget_get_window(widget); |
990 { | 868 event.x = allocation.x; |
991 GtkAllocation allocation; | 869 event.y = allocation.y; |
992 | 870 event.width = allocation.width; |
993 gtk_widget_get_allocation(widget, &allocation); | 871 event.height = allocation.height; |
994 event.x = allocation.x; | |
995 event.y = allocation.y; | |
996 event.width = allocation.width; | |
997 event.height = allocation.height; | |
998 } | |
999 #else | |
1000 event.window = widget->window; | |
1001 event.x = widget->allocation.x; | |
1002 event.y = widget->allocation.y; | |
1003 event.width = widget->allocation.width; | |
1004 event.height = widget->allocation.height; | |
1005 #endif | |
1006 | 872 |
1007 gtk_main_do_event((GdkEvent*)&event); | 873 gtk_main_do_event((GdkEvent*)&event); |
1008 } | 874 } |
1009 | 875 |
1010 static void | 876 static void |