comparison gtk3/dw.c @ 1919:78a65391dbcb

More GTK3 MDI fixes... remove duplicate code... Transition to gtk_render_background() in draw().
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 28 Sep 2016 23:23:57 +0000
parents 1814a6577a5f
children bc70b3e9dbb1
comparison
equal deleted inserted replaced
1918:1814a6577a5f 1919:78a65391dbcb
425 _dw_override_color (bottom_event_box, "background-color", &color); 425 _dw_override_color (bottom_event_box, "background-color", &color);
426 _dw_override_color (child_box, "background-color", &color); 426 _dw_override_color (child_box, "background-color", &color);
427 for (j = 0; j < 3; j++) 427 for (j = 0; j < 3; j++)
428 { 428 {
429 _dw_override_color (button[j], "background-color", &color); 429 _dw_override_color (button[j], "background-color", &color);
430 _dw_override_color (button[j], "background-color", &color);
431 } 430 }
432 gdk_rgba_parse (&color, GTK_MDI_LABEL_FOREGROUND); 431 gdk_rgba_parse (&color, GTK_MDI_LABEL_FOREGROUND);
433 _dw_override_color (label, "color", &color); 432 _dw_override_color (label, "color", &color);
434 #if GTK_CHECK_VERSION(3,16,0) 433 #if GTK_CHECK_VERSION(3,16,0)
435 gtk_label_set_xalign(GTK_LABEL(label), 0.0f); 434 gtk_label_set_xalign(GTK_LABEL(label), 0.0f);
580 { 579 {
581 GtkMdi *mdi; 580 GtkMdi *mdi;
582 GdkWindowAttr attributes; 581 GdkWindowAttr attributes;
583 gint attributes_mask; 582 gint attributes_mask;
584 GdkWindow *thiswindow; 583 GdkWindow *thiswindow;
585 GtkStyleContext *context; 584 GtkAllocation allocation;
586 585
587 mdi = GTK_MDI (widget); 586 mdi = GTK_MDI (widget);
588 587
589 g_return_if_fail (widget != NULL); 588 g_return_if_fail (widget != NULL);
590 g_return_if_fail (GTK_IS_MDI (mdi)); 589 g_return_if_fail (GTK_IS_MDI (mdi));
591 590
592 gtk_widget_set_realized(widget, TRUE); 591 gtk_widget_set_realized(widget, TRUE);
593 592
594 GtkAllocation allocation;
595 gtk_widget_get_allocation(widget, &allocation); 593 gtk_widget_get_allocation(widget, &allocation);
596 attributes.x = allocation.x; 594 attributes.x = allocation.x;
597 attributes.y = allocation.y; 595 attributes.y = allocation.y;
598 attributes.width = allocation.width; 596 attributes.width = allocation.width;
599 attributes.height = allocation.height; 597 attributes.height = allocation.height;
608 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; 606 attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
609 thiswindow = gdk_window_new (gtk_widget_get_parent_window(widget), &attributes, attributes_mask); 607 thiswindow = gdk_window_new (gtk_widget_get_parent_window(widget), &attributes, attributes_mask);
610 gtk_widget_set_window(widget, thiswindow); 608 gtk_widget_set_window(widget, thiswindow);
611 609
612 gdk_window_set_user_data (gtk_widget_get_window(widget), widget); 610 gdk_window_set_user_data (gtk_widget_get_window(widget), widget);
613
614 if((context = gtk_widget_get_style_context(widget)))
615 gtk_style_context_set_background (context, gtk_widget_get_window(widget));
616 } 611 }
617 612
618 static void gtk_mdi_get_preferred_width (GtkWidget *widget, gint *minimum_width, gint *natural_width) 613 static void gtk_mdi_get_preferred_width (GtkWidget *widget, gint *minimum_width, gint *natural_width)
619 { 614 {
620 GtkMdi *mdi; 615 GtkMdi *mdi;
745 static gboolean gtk_mdi_draw(GtkWidget *widget, cairo_t *cr) 740 static gboolean gtk_mdi_draw(GtkWidget *widget, cairo_t *cr)
746 { 741 {
747 GtkMdiChild *child; 742 GtkMdiChild *child;
748 GList *children; 743 GList *children;
749 GtkMdi *mdi; 744 GtkMdi *mdi;
745 GtkStyleContext *context;
750 746
751 g_return_val_if_fail (widget != NULL, FALSE); 747 g_return_val_if_fail (widget != NULL, FALSE);
752 g_return_val_if_fail (GTK_IS_MDI (widget), FALSE); 748 g_return_val_if_fail (GTK_IS_MDI (widget), FALSE);
753 g_return_val_if_fail (cr != NULL, FALSE); 749 g_return_val_if_fail (cr != NULL, FALSE);
754 750
755 mdi = GTK_MDI (widget); 751 mdi = GTK_MDI (widget);
752
753 if((context = gtk_widget_get_style_context(widget)))
754 {
755 GtkAllocation allocation;
756
757 gtk_widget_get_allocation (widget, &allocation);
758 gtk_render_background (context, cr, 0, 0, allocation.x, allocation.y);
759 }
760
756 for (children = mdi->children; children; children = children->next) 761 for (children = mdi->children; children; children = children->next)
757 { 762 {
758 child = (GtkMdiChild *) children->data; 763 child = (GtkMdiChild *) children->data;
759 gtk_container_propagate_draw (GTK_CONTAINER (mdi), 764 gtk_container_propagate_draw (GTK_CONTAINER (mdi),
760 child->widget, 765 child->widget,