eel_wrap_table_expose_event (GtkWidget *widget, GdkEventExpose *event) #endif { EelWrapTable *wrap_table; GList *iterator; g_assert (EEL_IS_WRAP_TABLE (widget)); g_assert (gtk_widget_get_realized (widget)); #if !GTK_CHECK_VERSION (3, 0, 0) g_assert (event != NULL); #endif wrap_table = EEL_WRAP_TABLE (widget); for (iterator = wrap_table->details->children; iterator; iterator = iterator->next) { g_assert (GTK_IS_WIDGET (iterator->data)); #if GTK_CHECK_VERSION (3, 0, 0) gtk_container_propagate_draw (GTK_CONTAINER (widget), GTK_WIDGET (iterator->data), cr); #else gtk_container_propagate_expose (GTK_CONTAINER (widget), GTK_WIDGET (iterator->data), event); #endif } return FALSE; }
static gboolean gtk_vkb_button_expose (GtkWidget *widget, GdkEventExpose *event) { GtkVkbButton *button = GTK_VKB_BUTTON(widget); GtkWidget *child; GList *children; GList *tmplist; g_return_val_if_fail(widget != NULL, FALSE); g_return_val_if_fail (GTK_IS_VKB_BUTTON(widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); if(GTK_WIDGET_DRAWABLE(widget)){ GtkStateType state = GTK_WIDGET_STATE(widget); if (!button->bg_pixmap) { gdk_window_set_background(widget->window, &button->bgcolor[state]); gdk_window_clear(widget->window); } children = gtk_container_get_children(GTK_CONTAINER(widget)); tmplist = children; while (tmplist) { child = GTK_WIDGET(tmplist->data); tmplist = tmplist->next; gtk_container_propagate_expose(GTK_CONTAINER(widget), child, event); } g_list_free(children); } return FALSE; }
static gboolean on_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, Starter *wcm) { GtkAllocation allocation; GdkWindow *window; cairo_t *cr; cairo_pattern_t *pattern; window = gtk_widget_get_window (widget); cr = gdk_cairo_create (window); gtk_widget_get_allocation (widget, &allocation); pattern = cairo_pattern_create_linear (0, 0, 0, allocation.height); if (gdk_screen_get_rgba_colormap (gtk_widget_get_screen (widget)) && gtk_widget_is_composited (widget)) cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0); /* transparent */ else cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* opaque white */ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); cairo_paint (cr); cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.6, 0.7, 0.9, 1.0); /* solid orange */ cairo_pattern_add_color_stop_rgba (pattern, 0.18, 1.0, 1.0, 1.0, 1.0); /* transparent orange */ cairo_set_source (cr, pattern); cairo_pattern_destroy (pattern); cairo_set_operator (cr, CAIRO_OPERATOR_OVER); cairo_paint (cr); cairo_destroy (cr); cr = gdk_cairo_create (window); gdk_cairo_set_source_pixbuf (cr, wcm->priv->logo, 20, 20); cairo_paint (cr); cairo_destroy (cr); GList *l, *list = NULL; list = gtk_container_get_children (GTK_CONTAINER (widget)); for (l = list; l != NULL; l = g_list_next (l)) gtk_container_propagate_expose (GTK_CONTAINER (widget), l->data, event); g_list_free (list); return TRUE; }
/* GObject Stuff */ static gboolean awn_tooltip_expose_event (GtkWidget *widget, GdkEventExpose *expose) { AwnTooltipPrivate *priv; cairo_t *cr; GtkAllocation alloc; gint width, height; priv = AWN_TOOLTIP (widget)->priv; gtk_widget_get_allocation (widget, &alloc); width = alloc.width; height = alloc.height; cr = gdk_cairo_create (gtk_widget_get_window (widget)); if (!cr) { return FALSE; } /* Clear the background to transparent */ cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); cairo_paint (cr); cairo_set_operator (cr, CAIRO_OPERATOR_OVER); cairo_set_line_width (cr, 1.0); /* Draw */ awn_cairo_set_source_color (cr, priv->bg); awn_cairo_rounded_rect (cr, 0, 0, width, height, TOOLTIP_ROUND_RADIUS, ROUND_ALL); if (priv->outline_color) { cairo_fill_preserve (cr); awn_cairo_set_source_color (cr, priv->outline_color); cairo_stroke (cr); } else { cairo_fill (cr); } /* Clean up */ cairo_destroy (cr); gtk_container_propagate_expose (GTK_CONTAINER (widget), gtk_bin_get_child (GTK_BIN (widget)), expose); return TRUE; }
gboolean gimp_overlay_child_expose (GimpOverlayBox *box, GimpOverlayChild *child, GdkEventExpose *event) { GtkWidget *widget; g_return_val_if_fail (GIMP_IS_OVERLAY_BOX (box), FALSE); g_return_val_if_fail (child != NULL, FALSE); g_return_val_if_fail (event != NULL, FALSE); widget = GTK_WIDGET (box); if (event->window == gtk_widget_get_window (widget)) { GtkAllocation child_allocation; GdkRectangle bounds; gtk_widget_get_allocation (child->widget, &child_allocation); gimp_overlay_child_transform_bounds (child, &child_allocation, &bounds); if (gtk_widget_get_visible (child->widget) && gdk_rectangle_intersect (&event->area, &bounds, NULL)) { GdkPixmap *pixmap = gdk_offscreen_window_get_pixmap (child->window); cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget)); gdk_cairo_region (cr, event->region); cairo_clip (cr); cairo_transform (cr, &child->matrix); gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0); cairo_paint_with_alpha (cr, child->opacity); cairo_destroy (cr); } } else if (event->window == child->window) { if (! gtk_widget_get_app_paintable (child->widget)) gtk_paint_flat_box (gtk_widget_get_style (child->widget), event->window, GTK_STATE_NORMAL, GTK_SHADOW_NONE, &event->area, widget, NULL, 0, 0, -1, -1); gtk_container_propagate_expose (GTK_CONTAINER (widget), child->widget, event); return TRUE; } return FALSE; }
/* From gtkcontainer.c */ static void _expose_child (GtkWidget *child,gpointer client_data) { struct { GtkWidget *container; GdkEventExpose *event; } *data = client_data; gtk_container_propagate_expose (GTK_CONTAINER (data->container), child, data->event); }
static gboolean eel_background_box_expose_event (GtkWidget *widget, GdkEventExpose *event) { eel_background_expose (widget, event); gtk_container_propagate_expose (GTK_CONTAINER (widget), gtk_bin_get_child (GTK_BIN (widget)), event); return TRUE; }
static gboolean matenu_menu_bar_real_expose_event (GtkWidget* base, GdkEventExpose* event) { MatenuMenuBar * self; gboolean result = FALSE; self = (MatenuMenuBar*) base; { GList* child_collection; GList* child_it; child_collection = gtk_container_get_children ((GtkContainer*) self); for (child_it = child_collection; child_it != NULL; child_it = child_it->next) { GtkWidget* child; child = (GtkWidget*) child_it->data; { gtk_container_propagate_expose ((GtkContainer*) self, child, event); } } _g_list_free0 (child_collection); } gtk_container_propagate_expose ((GtkContainer*) self, (GtkWidget*) self->priv->_overflown_arrow, event); result = FALSE; return result; }
/** * eel_gtk_container_child_expose_event: * * @container: A GtkContainer widget. * @child: A child of @container or NULL; * @event: The expose event. * * Forward an expose event to a child if needed. It is valid to give a NULL @child. * In that case this function is a noop. Proper clipping is done to ensure that the @child * does indeed need to be forwarded the exposure event. Finally, the forwarding * only occurs if the child is a NO_WINDOW widget. Of course, it is valid to feed * non NO_WINDOW widgets to this function, in which case this function is a noop. */ void eel_gtk_container_child_expose_event (GtkContainer *container, GtkWidget *child, GdkEventExpose *event) { g_return_if_fail (GTK_IS_CONTAINER (container)); if (child == NULL) { return; } g_return_if_fail (GTK_IS_WIDGET (child)); gtk_container_propagate_expose (container, child, event); }
static gint sp_widget_expose (GtkWidget *widget, GdkEventExpose *event) { GtkBin *bin; bin = GTK_BIN (widget); gtk_container_propagate_expose (GTK_CONTAINER(widget), bin->child, event); /* if ((bin->child) && (GTK_WIDGET_NO_WINDOW (bin->child))) { GdkEventExpose ce; ce = *event; gtk_widget_event (bin->child, (GdkEvent *) &ce); } */ return FALSE; }
/* To get gtk_widget_draw() to work, it is required to call * gtk_widget_size_allocate() in advance with a well-posed * allocation for a given child widget in order to set a * certain private GtkWidget variable, called * widget->priv->alloc_need, to the proper value; otherwise, * gtk_widget_draw() fails and the relevant scrollbar won't * appear on the screen. * * Calling gtk_form_position_child() like this is one of ways * to make sure of that. */ gtk_form_position_child(form, formchild, TRUE); gtk_form_render_background(formchild->widget, cr); } } return GTK_WIDGET_CLASS(gtk_form_parent_class)->draw(widget, cr); } #else /* !GTK_CHECK_VERSION(3,0,0) */ static gint gtk_form_expose(GtkWidget *widget, GdkEventExpose *event) { GList *tmp_list; GtkForm *form; g_return_val_if_fail(GTK_IS_FORM(widget), FALSE); form = GTK_FORM(widget); if (event->window == form->bin_window) return FALSE; for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) gtk_container_propagate_expose(GTK_CONTAINER(widget), GTK_WIDGET(((GtkFormChild *)tmp_list->data)->widget), event); return FALSE; }
static gboolean msd_osd_window_expose_event (GtkWidget *widget, GdkEventExpose *event) { MsdOsdWindow *window; GtkWidget *child; window = MSD_OSD_WINDOW (widget); if (window->priv->is_composited) expose_when_composited (widget, event); else expose_when_not_composited (widget, event); child = gtk_bin_get_child (GTK_BIN (window)); if (child) gtk_container_propagate_expose (GTK_CONTAINER (window), child, event); return FALSE; }
static gint mate_druid_expose (GtkWidget *widget, GdkEventExpose *event) { MateDruid *druid; GtkWidget *child; GList *children; g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (MATE_IS_DRUID (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); if (GTK_WIDGET_DRAWABLE (widget)) { druid = MATE_DRUID (widget); children = druid->_priv->children; while (children) { child = GTK_WIDGET (children->data); children = children->next; gtk_container_propagate_expose (GTK_CONTAINER (widget), child, event); } gtk_container_propagate_expose (GTK_CONTAINER (widget), druid->_priv->bbox, event); #if 0 gtk_container_propagate_expose (GTK_CONTAINER (widget), druid->back, event); gtk_container_propagate_expose (GTK_CONTAINER (widget), druid->next, event); gtk_container_propagate_expose (GTK_CONTAINER (widget), druid->cancel, event); gtk_container_propagate_expose (GTK_CONTAINER (widget), druid->finish, event); gtk_container_propagate_expose (GTK_CONTAINER (widget), druid->help, event); #endif } return FALSE; }
static int eel_wrap_table_expose_event (GtkWidget *widget, GdkEventExpose *event) { EelWrapTable *wrap_table; GList *iterator; g_assert (EEL_IS_WRAP_TABLE (widget)); g_assert (gtk_widget_get_realized (widget)); g_assert (event != NULL); wrap_table = EEL_WRAP_TABLE (widget); for (iterator = wrap_table->details->children; iterator; iterator = iterator->next) { g_assert (GTK_IS_WIDGET (iterator->data)); gtk_container_propagate_expose (GTK_CONTAINER (widget), GTK_WIDGET (iterator->data), event); } return FALSE; }
static gint hildon_home_window_expose (GtkWidget *widget, GdkEventExpose *event) { HildonHomeWindow *window; HildonHomeWindowPrivate *priv; GtkWidget *child; window = HILDON_HOME_WINDOW (widget); priv = window->priv; child = GTK_BIN (widget)->child; if (GTK_IS_WIDGET (priv->titlebar)) gtk_container_propagate_expose (GTK_CONTAINER (widget), priv->titlebar, event); if (GTK_WIDGET_CLASS (hildon_home_window_parent_class)->expose_event) return GTK_WIDGET_CLASS (hildon_home_window_parent_class)->expose_event (widget, event); else return TRUE; }
static gboolean gtk_offscreen_box_expose (GtkWidget *widget, GdkEventExpose *event) { GtkOffscreenBox *offscreen_box = GTK_OFFSCREEN_BOX (widget); if (gtk_widget_is_drawable (widget)) { if (event->window == widget->window) { GdkPixmap *pixmap; GtkAllocation child_area; cairo_t *cr; int start_y = 0; if (offscreen_box->child1 && gtk_widget_get_visible (offscreen_box->child1)) { pixmap = gdk_offscreen_window_get_pixmap (offscreen_box->offscreen_window1); child_area = offscreen_box->child1->allocation; cr = gdk_cairo_create (widget->window); gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0); cairo_paint (cr); cairo_destroy (cr); start_y += child_area.height; } if (offscreen_box->child2 && gtk_widget_get_visible (offscreen_box->child2)) { pixmap = gdk_offscreen_window_get_pixmap (offscreen_box->offscreen_window2); child_area = offscreen_box->child2->allocation; cr = gdk_cairo_create (widget->window); /* transform */ cairo_translate (cr, 0, start_y); cairo_translate (cr, child_area.width / 2, child_area.height / 2); cairo_rotate (cr, offscreen_box->angle); cairo_translate (cr, -child_area.width / 2, -child_area.height / 2); /* paint */ gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0); cairo_paint (cr); cairo_destroy (cr); } } else if (event->window == offscreen_box->offscreen_window1) { gtk_paint_flat_box (widget->style, event->window, GTK_STATE_NORMAL, GTK_SHADOW_NONE, &event->area, widget, "blah", 0, 0, -1, -1); if (offscreen_box->child1) gtk_container_propagate_expose (GTK_CONTAINER (widget), offscreen_box->child1, event); } else if (event->window == offscreen_box->offscreen_window2) { gtk_paint_flat_box (widget->style, event->window, GTK_STATE_NORMAL, GTK_SHADOW_NONE, &event->area, widget, "blah", 0, 0, -1, -1); if (offscreen_box->child2) gtk_container_propagate_expose (GTK_CONTAINER (widget), offscreen_box->child2, event); } } return FALSE; }
static gboolean gtk_mirror_bin_expose (GtkWidget *widget, GdkEventExpose *event) { GtkMirrorBin *bin = GTK_MIRROR_BIN (widget); gint width, height; if (gtk_widget_is_drawable (widget)) { if (event->window == widget->window) { GdkPixmap *pixmap; cairo_t *cr; cairo_matrix_t matrix; cairo_pattern_t *mask; if (bin->child && gtk_widget_get_visible (bin->child)) { pixmap = gdk_offscreen_window_get_pixmap (bin->offscreen_window); gdk_drawable_get_size (pixmap, &width, &height); cr = gdk_cairo_create (widget->window); cairo_save (cr); cairo_rectangle (cr, 0, 0, width, height); cairo_clip (cr); /* paint the offscreen child */ gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0); cairo_paint (cr); cairo_restore (cr); cairo_matrix_init (&matrix, 1.0, 0.0, 0.3, 1.0, 0.0, 0.0); cairo_matrix_scale (&matrix, 1.0, -1.0); cairo_matrix_translate (&matrix, -10, - 3 * height - 10); cairo_transform (cr, &matrix); cairo_rectangle (cr, 0, height, width, height); cairo_clip (cr); gdk_cairo_set_source_pixmap (cr, pixmap, 0, height); /* create linear gradient as mask-pattern to fade out the source */ mask = cairo_pattern_create_linear (0.0, height, 0.0, 2*height); cairo_pattern_add_color_stop_rgba (mask, 0.0, 0.0, 0.0, 0.0, 0.0); cairo_pattern_add_color_stop_rgba (mask, 0.25, 0.0, 0.0, 0.0, 0.01); cairo_pattern_add_color_stop_rgba (mask, 0.5, 0.0, 0.0, 0.0, 0.25); cairo_pattern_add_color_stop_rgba (mask, 0.75, 0.0, 0.0, 0.0, 0.5); cairo_pattern_add_color_stop_rgba (mask, 1.0, 0.0, 0.0, 0.0, 1.0); /* paint the reflection */ cairo_mask (cr, mask); cairo_pattern_destroy (mask); cairo_destroy (cr); } } else if (event->window == bin->offscreen_window) { gtk_paint_flat_box (widget->style, event->window, GTK_STATE_NORMAL, GTK_SHADOW_NONE, &event->area, widget, "blah", 0, 0, -1, -1); if (bin->child) gtk_container_propagate_expose (GTK_CONTAINER (widget), bin->child, event); } } return FALSE; }
static gboolean egg_panel_ebox_expose (GtkWidget *ebox, GdkEventExpose *event, EggPanel *panel) { EggPanelPrivate *priv = panel->priv; GdkRectangle alloc; cairo_pattern_t *pt; cairo_t *cr; double r1, r2, g1, g2, b1, b2; GtkStyle *style; GtkStateType state; /* * Determine state from button press. */ state = (priv->state == STATE_DRAGGING) ? GTK_STATE_SELECTED : GTK_STATE_NORMAL; /* * Create cairo context and clip drawing area to event region. */ cr = gdk_cairo_create(event->window); gdk_cairo_rectangle(cr, &event->area); cairo_clip(cr); /* * Get gradient colors. */ style = gtk_widget_get_style(ebox); r1 = style->bg[state].red / 65535.; g1 = style->bg[state].green / 65535.; b1 = style->bg[state].blue / 65535.; r2 = style->dark[state].red / 65535.; g2 = style->dark[state].green / 65535.; b2 = style->dark[state].blue / 65535.; /* * Draw the background gradient. */ gtk_widget_get_allocation(ebox, &alloc); pt = cairo_pattern_create_linear(0., 0., 0., alloc.height); cairo_pattern_add_color_stop_rgb(pt, 0., r1, g1, b1); cairo_pattern_add_color_stop_rgb(pt, 1., r2, g2, b2); cairo_rectangle(cr, 0., 0., alloc.width, alloc.height); cairo_set_source(cr, pt); cairo_fill(cr); /* * Cleanup resources. */ cairo_pattern_destroy(pt); cairo_destroy(cr); /* * Expose the child. */ gtk_container_propagate_expose(GTK_CONTAINER(ebox), panel->priv->header, event); return FALSE; }