X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=gtk%2Fsrc%2Fghbcompositor.c;h=81628b6bf1940500c6900d344c9c573ec1b355a3;hb=9460d9624a5cf24126bc39605bc47d43330fcdf4;hp=eec5c09afc5813a3a008ce2bf3bbbc75d78495c6;hpb=30d76453a9337737d2d88360dc30103c167adb77;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/gtk/src/ghbcompositor.c b/gtk/src/ghbcompositor.c index eec5c09a..81628b6b 100644 --- a/gtk/src/ghbcompositor.c +++ b/gtk/src/ghbcompositor.c @@ -32,12 +32,6 @@ #include #include "ghbcompositor.h" -#ifdef ENABLE_NLS -#define P_(String) g_dgettext(GETTEXT_PACKAGE "-properties",String) -#else -#define P_(String) (String) -#endif - enum { PROP_0, }; @@ -119,16 +113,16 @@ ghb_compositor_class_init (GhbCompositorClass *class) gtk_container_class_install_child_property (container_class, CHILD_PROP_Z_POS, g_param_spec_uint ("z-pos", - P_("Position in Z-List"), - P_("Sets the blending order of the child."), + "Position in Z-List", + "Sets the blending order of the child.", 0, 65535, 0, GTK_PARAM_READWRITE)); gtk_container_class_install_child_property (container_class, CHILD_PROP_OPACITY, g_param_spec_double ("opacity", - P_("Opacity"), - P_("Sets the opacity of the child."), + "Opacity", + "Sets the opacity of the child.", 0.0, 1.0, 1.0, GTK_PARAM_READWRITE)); @@ -294,21 +288,21 @@ ghb_compositor_new (void) static void showtype(const gchar *msg, GtkWidget *widget) { - GType type; - gchar *str; - - type = GTK_WIDGET_TYPE(widget); - if (type == GTK_TYPE_DRAWING_AREA) - str = "drawing area"; - else if (type == GTK_TYPE_ALIGNMENT) - str = "alignment"; - else if (type == GTK_TYPE_EVENT_BOX) - str = "event box"; - else if (type == GTK_TYPE_EVENT_BOX) - str = "event box"; - else - str = "unknown"; - g_message("%s: %s", msg, str); + GType type; + gchar *str; + + type = GTK_WIDGET_TYPE(widget); + if (type == GTK_TYPE_DRAWING_AREA) + str = "drawing area"; + else if (type == GTK_TYPE_ALIGNMENT) + str = "alignment"; + else if (type == GTK_TYPE_EVENT_BOX) + str = "event box"; + else if (type == GTK_TYPE_EVENT_BOX) + str = "event box"; + else + str = "unknown"; + g_message("%s: %s", msg, str); } #endif @@ -360,7 +354,6 @@ ghb_compositor_zlist_insert ( gint z_pos, gdouble opacity) { - GtkWidget *widget; GhbCompositorChild *cc; GdkDisplay *display; @@ -368,18 +361,18 @@ ghb_compositor_zlist_insert ( g_return_if_fail (GTK_IS_WIDGET (child)); g_return_if_fail (child->parent == NULL); - widget = GTK_WIDGET (compositor); + gtk_widget_set_parent(child, GTK_WIDGET(compositor)); + + display = gtk_widget_get_display (GTK_WIDGET(compositor)); cc = g_new(GhbCompositorChild, 1); cc->widget = child; cc->z_pos = z_pos; cc->opacity = opacity; + cc->drawables = NULL; compositor->children = g_list_insert_sorted( compositor->children, cc, zsort); - gtk_widget_set_parent(child, GTK_WIDGET(compositor)); - - display = gtk_widget_get_display (GTK_WIDGET(compositor)); if (gdk_display_supports_composite(display)) { GList *link; @@ -552,7 +545,6 @@ ghb_compositor_size_request( requisition->width = width + GTK_CONTAINER (widget)->border_width * 2; requisition->height = height + GTK_CONTAINER (widget)->border_width * 2; -g_message("request_size %d x %d", requisition->width, requisition->height); } static void @@ -578,6 +570,7 @@ ghb_compositor_size_allocate (GtkWidget *widget, GtkAllocation *allocation) child_allocation.x = 0; child_allocation.y = 0; } + child_allocation.width = MAX (allocation->width - GTK_CONTAINER (widget)->border_width * 2, 0); child_allocation.height = MAX (allocation->height - @@ -597,7 +590,8 @@ ghb_compositor_size_allocate (GtkWidget *widget, GtkAllocation *allocation) for (link = compositor->children; link != NULL; link = link->next) { cc = (GhbCompositorChild*)link->data; - gtk_widget_size_allocate (cc->widget, &child_allocation); + if (GTK_WIDGET_REALIZED (cc->widget)) + gtk_widget_size_allocate (cc->widget, &child_allocation); } } @@ -611,6 +605,7 @@ ghb_compositor_blend (GtkWidget *widget, GdkEventExpose *event) cairo_t *cr; GhbCompositorChild *cc; + if (compositor->children == NULL) return; /* create a cairo context to draw to the window */ cr = gdk_cairo_create (widget->window);