static void actor_realize_not_recursive (void) { ClutterActor *actor, *group; ClutterActor *stage; stage = clutter_test_get_stage (); clutter_actor_show (stage); group = clutter_actor_new (); actor = clutter_actor_new (); clutter_actor_hide (group); /* don't show, so won't map */ clutter_actor_hide (actor); /* don't show, so won't map */ g_assert (!(CLUTTER_ACTOR_IS_REALIZED (group))); g_assert (!(CLUTTER_ACTOR_IS_REALIZED (actor))); clutter_actor_add_child (stage, group); clutter_actor_add_child (group, actor); clutter_actor_realize (group); g_assert (CLUTTER_ACTOR_IS_REALIZED (group)); g_assert (!(CLUTTER_ACTOR_IS_MAPPED (group))); g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (group))); /* realizing group did not realize the child */ g_assert (!CLUTTER_ACTOR_IS_REALIZED (actor)); g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor))); g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (actor))); }
static void mx_scroll_view_allocate (ClutterActor *actor, const ClutterActorBox *box, ClutterAllocationFlags flags) { MxPadding padding; ClutterActorBox child_box; gfloat avail_width, avail_height, sb_width, sb_height; MxScrollViewPrivate *priv = MX_SCROLL_VIEW (actor)->priv; CLUTTER_ACTOR_CLASS (mx_scroll_view_parent_class)-> allocate (actor, box, flags); mx_widget_get_padding (MX_WIDGET (actor), &padding); avail_width = (box->x2 - box->x1) - padding.left - padding.right; avail_height = (box->y2 - box->y1) - padding.top - padding.bottom; sb_width = priv->scrollbar_width; sb_height = priv->scrollbar_height; if (!CLUTTER_ACTOR_IS_VISIBLE (priv->vscroll)) sb_width = 0; if (!CLUTTER_ACTOR_IS_VISIBLE (priv->hscroll)) sb_height = 0; /* Vertical scrollbar */ if (CLUTTER_ACTOR_IS_VISIBLE (priv->vscroll)) { child_box.x1 = avail_width - sb_width; child_box.y1 = padding.top; child_box.x2 = avail_width; child_box.y2 = child_box.y1 + avail_height - sb_height; clutter_actor_allocate (priv->vscroll, &child_box, flags); } /* Horizontal scrollbar */ if (CLUTTER_ACTOR_IS_VISIBLE (priv->hscroll)) { child_box.x1 = padding.left; child_box.x2 = child_box.x1 + avail_width - sb_width; child_box.y1 = avail_height - sb_height; child_box.y2 = avail_height; clutter_actor_allocate (priv->hscroll, &child_box, flags); } /* Child */ child_box.x1 = padding.left; child_box.x2 = avail_width - sb_width; child_box.y1 = padding.top; child_box.y2 = avail_height - sb_height; if (priv->child) clutter_actor_allocate (priv->child, &child_box, flags); }
gboolean mex_info_bar_dialog_visible (MexInfoBar *self) { MexInfoBarPrivate *priv = self->priv; return (CLUTTER_ACTOR_IS_VISIBLE (priv->power_dialog) || CLUTTER_ACTOR_IS_VISIBLE (priv->settings_dialog)); }
static void tidy_scroll_view_paint (ClutterActor *actor) { TidyScrollViewPrivate *priv = TIDY_SCROLL_VIEW (actor)->priv; if (priv->child && CLUTTER_ACTOR_IS_VISIBLE (priv->child)) clutter_actor_paint (priv->child); if (CLUTTER_ACTOR_IS_VISIBLE (priv->hscroll)) clutter_actor_paint (priv->hscroll); if (CLUTTER_ACTOR_IS_VISIBLE (priv->vscroll)) clutter_actor_paint (priv->vscroll); }
static void st_scroll_view_paint (ClutterActor *actor) { StScrollViewPrivate *priv = ST_SCROLL_VIEW (actor)->priv; /* StBin will paint the child */ CLUTTER_ACTOR_CLASS (st_scroll_view_parent_class)->paint (actor); /* paint our custom children */ if (priv->hscrollbar_visible && CLUTTER_ACTOR_IS_VISIBLE (priv->hscroll)) clutter_actor_paint (priv->hscroll); if (priv->vscrollbar_visible && CLUTTER_ACTOR_IS_VISIBLE (priv->vscroll)) clutter_actor_paint (priv->vscroll); }
static gboolean _close_dialog_cb (gpointer unused, MexInfoBar *self) { MexInfoBarPrivate *priv = self->priv; if (CLUTTER_ACTOR_IS_VISIBLE (priv->power_dialog)) clutter_actor_hide (priv->power_dialog); if (CLUTTER_ACTOR_IS_VISIBLE (priv->settings_dialog)) clutter_actor_hide (priv->settings_dialog); mex_push_focus (MX_FOCUSABLE (self)); return FALSE; }
static void mx_scroll_view_pick (ClutterActor *actor, const ClutterColor *color) { MxScrollViewPrivate *priv = MX_SCROLL_VIEW (actor)->priv; /* Chain up so we get a bounding box pained (if we are reactive) */ CLUTTER_ACTOR_CLASS (mx_scroll_view_parent_class)->pick (actor, color); /* paint our custom children */ if (CLUTTER_ACTOR_IS_VISIBLE (priv->hscroll)) clutter_actor_paint (priv->hscroll); if (CLUTTER_ACTOR_IS_VISIBLE (priv->vscroll)) clutter_actor_paint (priv->vscroll); }
void show_tile_preview (MetaPlugin *plugin, MetaWindow *window, MetaRectangle *tile_rect, int tile_monitor_number) { MetaScreen *screen = meta_plugin_get_screen (plugin); ScreenTilePreview *preview = get_screen_tile_preview (screen); ClutterActor *window_actor; if (CLUTTER_ACTOR_IS_VISIBLE (preview->actor) && preview->tile_rect.x == tile_rect->x && preview->tile_rect.y == tile_rect->y && preview->tile_rect.width == tile_rect->width && preview->tile_rect.height == tile_rect->height) return; /* nothing to do */ clutter_actor_set_position (preview->actor, tile_rect->x, tile_rect->y); clutter_actor_set_size (preview->actor, tile_rect->width, tile_rect->height); clutter_actor_show (preview->actor); window_actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window)); clutter_actor_lower (preview->actor, window_actor); preview->tile_rect = *tile_rect; }
static void mx_notebook_allocate (ClutterActor *actor, const ClutterActorBox *box, ClutterAllocationFlags flags) { MxNotebookPrivate *priv = MX_NOTEBOOK (actor)->priv; GList *l; MxPadding padding; ClutterActorBox childbox; CLUTTER_ACTOR_CLASS (mx_notebook_parent_class)->allocate (actor, box, flags); mx_widget_get_padding (MX_WIDGET (actor), &padding); childbox.x1 = 0 + padding.left; childbox.x2 = box->x2 - box->x1 - padding.right; childbox.y1 = 0 + padding.top; childbox.y2 = box->y2 - box->y1 - padding.bottom; for (l = priv->children; l; l = l->next) { ClutterActor *child; child = CLUTTER_ACTOR (l->data); if (CLUTTER_ACTOR_IS_VISIBLE (l->data)) clutter_actor_allocate (child, &childbox, flags); } }
void test_realized (TestConformSimpleFixture *fixture, gconstpointer data) { ClutterActor *actor; ClutterActor *stage; stage = clutter_stage_get_default (); actor = clutter_rectangle_new (); g_assert (!(CLUTTER_ACTOR_IS_REALIZED (actor))); clutter_actor_hide (actor); /* don't show, so won't map */ clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor); clutter_actor_realize (actor); g_assert (CLUTTER_ACTOR_IS_REALIZED (actor)); g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor))); g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (actor))); clutter_actor_destroy (actor); }
static void st_container_remove (ClutterContainer *container, ClutterActor *actor) { StContainerPrivate *priv = ST_CONTAINER (container)->priv; g_object_ref (actor); priv->children = g_list_remove (priv->children, actor); clutter_actor_unparent (actor); /* queue a relayout, to get the correct positioning inside * the ::actor-removed signal handlers */ clutter_actor_queue_relayout (CLUTTER_ACTOR (container)); /* at this point, the actor passed to the "actor-removed" signal * handlers is not parented anymore to the container but since we * are holding a reference on it, it's still valid */ g_signal_emit_by_name (container, "actor-removed", actor); st_container_update_pseudo_classes (ST_CONTAINER (container)); if (CLUTTER_ACTOR_IS_VISIBLE (container)) clutter_actor_queue_redraw (CLUTTER_ACTOR (container)); g_object_unref (actor); }
static gboolean mx_menu_event (ClutterActor *actor, ClutterEvent *event) { /* We swallow mouse events so that they don't fall through to whatever's * beneath us. */ switch (event->type) { case CLUTTER_MOTION: case CLUTTER_BUTTON_PRESS: case CLUTTER_BUTTON_RELEASE: case CLUTTER_SCROLL: return TRUE; case CLUTTER_KEY_PRESS: case CLUTTER_KEY_RELEASE: /* hide the menu if the escape key was pressed */ if (((ClutterKeyEvent*) event)->keyval == CLUTTER_KEY_Escape && CLUTTER_ACTOR_IS_VISIBLE (actor)) { mx_menu_close (actor); } default: return FALSE; } }
static void mx_stack_paint_children (ClutterActor *actor) { MxStackPrivate *priv = MX_STACK (actor)->priv; GList *c; for (c = priv->children; c; c = c->next) { ClutterActor *child = c->data; gboolean crop; if (!CLUTTER_ACTOR_IS_VISIBLE (child)) continue; clutter_container_child_get (CLUTTER_CONTAINER (actor), child, "crop", &crop, NULL); if (crop) { /* clip */ cogl_clip_push_rectangle (priv->allocation.x1, priv->allocation.y1, priv->allocation.x2, priv->allocation.y2); clutter_actor_paint (c->data); cogl_clip_pop (); } else clutter_actor_paint (c->data); } }
/* Allocation of a view changed */ static void _xfdashboard_viewpad_update_scrollbars(XfdashboardViewpad *self) { XfdashboardViewpadPrivate *priv; gfloat w, h; g_return_if_fail(XFDASHBOARD_IS_VIEWPAD(self)); priv=self->priv; /* Set range of scroll bar to width and height of active view * But we need to check for nan-values here - I do not get rid of it :( */ if(priv->activeView) clutter_actor_get_size(CLUTTER_ACTOR(priv->activeView), &w, &h); else w=h=1.0f; xfdashboard_scrollbar_set_range(XFDASHBOARD_SCROLLBAR(priv->hScrollbar), isnan(w)==0 ? w : 0.0f); xfdashboard_scrollbar_set_range(XFDASHBOARD_SCROLLBAR(priv->vScrollbar), isnan(h)==0 ? h : 0.0f); /* If any scroll bar policy is automatic then reallocate the * same allocation again in an unkindly way to force a recalculation * if scroll bars needed to shown (or hidden what is unlikely) */ if(CLUTTER_ACTOR_IS_VISIBLE(self) && (priv->hScrollbarPolicy==XFDASHBOARD_POLICY_AUTOMATIC || priv->vScrollbarPolicy==XFDASHBOARD_POLICY_AUTOMATIC)) { ClutterActorBox box; clutter_actor_get_allocation_box(CLUTTER_ACTOR(self), &box); _xfdashboard_viewpad_allocate(CLUTTER_ACTOR(self), &box, CLUTTER_DELEGATE_LAYOUT); } }
static gboolean glide_slide_button_drawing_area_expose (GtkWidget *drawing_area, GdkEventExpose *event, gpointer user_data) { GlideSlideButton *b = (GlideSlideButton *)user_data; cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (drawing_area)); gfloat width, height; clutter_actor_get_size (CLUTTER_ACTOR (b->priv->slide), &width, &height); cairo_save (cr); cairo_scale (cr, 80.0/width, 60.0/height); glide_actor_print (GLIDE_ACTOR (b->priv->slide), cr); cairo_restore (cr); if (CLUTTER_ACTOR_IS_VISIBLE (b->priv->slide)) { glide_cairo_set_fg_color (cr, drawing_area, GTK_STATE_NORMAL); cairo_set_line_width (cr, 3); cairo_rectangle (cr, 0, 0, 80, 60); cairo_stroke (cr); } cairo_destroy (cr); return FALSE; }
static void mpl_application_view_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { MplApplicationViewPrivate *priv = APPLICATION_VIEW_PRIVATE (object); switch (property_id) { case PROP_ICON: g_value_set_object (value, priv->icon); break; case PROP_TITLE: g_value_set_string (value, mx_label_get_text (MX_LABEL (priv->title))); break; case PROP_SUBTITLE: g_value_set_string (value, mx_label_get_text (MX_LABEL (priv->subtitle))); break; case PROP_CAN_CLOSE: g_value_set_boolean (value, CLUTTER_ACTOR_IS_VISIBLE (priv->close_button)); break; case PROP_THUMBNAIL: g_value_set_object (value, priv->thumbnail); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } }
static gboolean on_fullscreen (GtkWindow *window, GdkEventWindowState *event, CalibArea *area) { ClutterRect rect; if ((event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) == 0) return FALSE; /* Protect against window state multiple changes*/ if (CLUTTER_ACTOR_IS_VISIBLE (area->action_layer)) return FALSE; clutter_actor_show (area->action_layer); clutter_actor_show (area->clock); rect.origin.x = 0; rect.origin.y = 0; clutter_actor_get_size (area->helper_text_title, &rect.size.width, &rect.size.height); g_object_set (area->text_title_holder, "clip-rect", &rect, NULL); clutter_actor_get_size (area->helper_text_body, &rect.size.width, &rect.size.height); g_object_set (area->text_body_holder, "clip-rect", &rect, NULL); clutter_actor_set_y (area->helper_text_body, - clutter_actor_get_height (area->helper_text_body)); show_helper_text_title (area); return FALSE; }
static gboolean mex_music_player_captured_event (ClutterActor *actor, ClutterEvent *event) { MexMusicPlayerPrivate *priv = MEX_MUSIC_PLAYER (actor)->priv; ClutterKeyEvent *kevent; if (event->type != CLUTTER_KEY_PRESS) return FALSE; kevent = (ClutterKeyEvent *) event; if (MEX_KEY_INFO (kevent->keyval)) { ClutterActor *tracks; tracks = mex_script_get_actor (priv->script, "tracks-scrollview"); if (CLUTTER_ACTOR_IS_VISIBLE (tracks)) clutter_actor_hide (tracks); else clutter_actor_show (tracks); return TRUE; } return FALSE; }
static gboolean mx_menu_event (ClutterActor *actor, ClutterEvent *event) { /* We swallow mouse events so that they don't fall through to whatever's * beneath us. */ switch (event->type) { case CLUTTER_MOTION: case CLUTTER_BUTTON_PRESS: case CLUTTER_BUTTON_RELEASE: case CLUTTER_SCROLL: return TRUE; case CLUTTER_KEY_PRESS: case CLUTTER_KEY_RELEASE: /* hide the menu if the escape key was pressed */ if (((ClutterKeyEvent*) event)->keyval == CLUTTER_KEY_Escape && CLUTTER_ACTOR_IS_VISIBLE (actor)) { clutter_actor_set_reactive (actor, FALSE); clutter_actor_animate (actor, CLUTTER_LINEAR, 250, "opacity", (guchar) 0, "signal-swapped::completed", clutter_actor_hide, actor, NULL); } default: return FALSE; } }
/** * clutter_rectangle_set_border_width: * @rectangle: a #ClutterRectangle * @width: the width of the border * * Sets the width (in pixel) of the border used by @rectangle. * A @width of 0 will unset the border. * * Since: 0.2 */ void clutter_rectangle_set_border_width (ClutterRectangle *rectangle, guint width) { ClutterRectanglePrivate *priv; g_return_if_fail (CLUTTER_IS_RECTANGLE (rectangle)); priv = rectangle->priv; if (priv->border_width != width) { g_object_ref (rectangle); priv->border_width = width; if (priv->border_width != 0) priv->has_border = TRUE; else priv->has_border = FALSE; if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR (rectangle))) clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle)); g_object_notify (G_OBJECT (rectangle), "border-width"); g_object_notify (G_OBJECT (rectangle), "has-border"); g_object_unref (rectangle); } }
/** * clutter_rectangle_set_color: * @rectangle: a #ClutterRectangle * @color: a #ClutterColor * * Sets the color of @rectangle. */ void clutter_rectangle_set_color (ClutterRectangle *rectangle, const ClutterColor *color) { ClutterRectanglePrivate *priv; g_return_if_fail (CLUTTER_IS_RECTANGLE (rectangle)); g_return_if_fail (color != NULL); g_object_ref (rectangle); priv = rectangle->priv; priv->color.red = color->red; priv->color.green = color->green; priv->color.blue = color->blue; priv->color.alpha = color->alpha; #if 0 /* FIXME - appears to be causing border to always get drawn */ if (clutter_color_equal (&priv->color, &priv->border_color)) priv->has_border = FALSE; else priv->has_border = TRUE; #endif if (CLUTTER_ACTOR_IS_VISIBLE (rectangle)) clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle)); g_object_notify (G_OBJECT (rectangle), "color"); g_object_notify (G_OBJECT (rectangle), "has-border"); g_object_unref (rectangle); }
void test_show_on_set_parent (TestConformSimpleFixture *fixture, gconstpointer data) { ClutterActor *actor, *group; gboolean show_on_set_parent; ClutterActor *stage; stage = clutter_stage_get_default (); group = clutter_group_new (); g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (group))); clutter_container_add_actor (CLUTTER_CONTAINER (stage), group); actor = clutter_rectangle_new (); g_object_get (G_OBJECT (actor), "show-on-set-parent", &show_on_set_parent, NULL); g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (actor))); g_assert (show_on_set_parent == TRUE); clutter_group_add (group, actor); g_object_get (G_OBJECT (actor), "show-on-set-parent", &show_on_set_parent, NULL); g_assert (CLUTTER_ACTOR_IS_VISIBLE (actor)); g_assert (show_on_set_parent == TRUE); g_object_ref (actor); clutter_actor_unparent (actor); g_object_get (G_OBJECT (actor), "show-on-set-parent", &show_on_set_parent, NULL); g_assert (!CLUTTER_ACTOR_IS_REALIZED (actor)); g_assert (!CLUTTER_ACTOR_IS_MAPPED (actor)); g_assert (CLUTTER_ACTOR_IS_VISIBLE (actor)); g_assert (show_on_set_parent == TRUE); clutter_actor_destroy (actor); clutter_actor_destroy (group); }
static void clutter_glx_texture_pixmap_update_area (ClutterX11TexturePixmap *texture, gint x, gint y, gint width, gint height) { ClutterGLXTexturePixmapPrivate *priv; Display *dpy; CLUTTER_NOTE (TEXTURE, "Updating texture pixmap"); priv = CLUTTER_GLX_TEXTURE_PIXMAP (texture)->priv; dpy = clutter_x11_get_default_display(); if (!CLUTTER_ACTOR_IS_REALIZED (texture)) return; if (priv->use_fallback) { CLUTTER_NOTE (TEXTURE, "Falling back to X11"); parent_class->update_area (texture, x, y, width, height); return; } if (priv->glx_pixmap == None) return; if (texture_bind (CLUTTER_GLX_TEXTURE_PIXMAP(texture))) { CLUTTER_NOTE (TEXTURE, "Really updating via GLX"); clutter_x11_trap_x_errors (); (_gl_bind_tex_image) (dpy, priv->glx_pixmap, GLX_FRONT_LEFT_EXT, NULL); XSync (clutter_x11_get_default_display(), FALSE); /* Note above fires X error for non name pixmaps - but * things still seem to work - i.e pixmap updated */ if (clutter_x11_untrap_x_errors ()) CLUTTER_NOTE (TEXTURE, "Update bind_tex_image failed"); priv->bound = TRUE; } else g_warning ("Failed to bind initial tex"); if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR(texture))) clutter_actor_queue_redraw (CLUTTER_ACTOR(texture)); }
static void st_box_layout_paint (ClutterActor *actor) { StBoxLayout *self = ST_BOX_LAYOUT (actor); StBoxLayoutPrivate *priv = self->priv; StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor)); GList *l, *children; gdouble x, y; ClutterActorBox allocation_box; ClutterActorBox content_box; get_border_paint_offsets (self, &x, &y); if (x != 0 || y != 0) { cogl_push_matrix (); cogl_translate ((int)x, (int)y, 0); } CLUTTER_ACTOR_CLASS (st_box_layout_parent_class)->paint (actor); if (x != 0 || y != 0) { cogl_pop_matrix (); } children = st_container_get_children_list (ST_CONTAINER (actor)); if (children == NULL) return; clutter_actor_get_allocation_box (actor, &allocation_box); st_theme_node_get_content_box (theme_node, &allocation_box, &content_box); content_box.x1 += x; content_box.y1 += y; content_box.x2 += x; content_box.y2 += y; /* The content area forms the viewport into the scrolled contents, while * the borders and background stay in place; after drawing the borders and * background, we clip to the content area */ if (priv->hadjustment || priv->vadjustment) cogl_clip_push_rectangle ((int)content_box.x1, (int)content_box.y1, (int)content_box.x2, (int)content_box.y2); for (l = children; l; l = g_list_next (l)) { ClutterActor *child = (ClutterActor*) l->data; if (CLUTTER_ACTOR_IS_VISIBLE (child)) clutter_actor_paint (child); } if (priv->hadjustment || priv->vadjustment) cogl_clip_pop (); }
static void glide_slide_button_undo_position_changed (GlideUndoManager *manager, gpointer user_data) { GlideSlideButton *b = (GlideSlideButton *)user_data; if (CLUTTER_ACTOR_IS_VISIBLE (b->priv->slide)) gtk_widget_queue_draw (GTK_WIDGET (b)); }
static void tweet_overlay_sort_depth_order (ClutterContainer *container) { TweetOverlayPrivate *priv = TWEET_OVERLAY (container)->priv; priv->children = g_list_sort (priv->children, sort_z_order); if (CLUTTER_ACTOR_IS_VISIBLE (container)) clutter_actor_queue_redraw (CLUTTER_ACTOR (container)); }
static void st_container_sort_depth_order (ClutterContainer *container) { StContainerPrivate *priv = ST_CONTAINER (container)->priv; priv->children = g_list_sort (priv->children, sort_z_order); if (CLUTTER_ACTOR_IS_VISIBLE (container)) clutter_actor_queue_redraw (CLUTTER_ACTOR (container)); }
static gboolean shell_generic_container_get_paint_volume (ClutterActor *self, ClutterPaintVolume *volume) { ClutterActorBox paint_box, alloc_box; StThemeNode *theme_node; ClutterVertex origin; /* Setting the paint volume does not make sense when we don't have any allocation */ if (!clutter_actor_has_allocation (self)) return FALSE; theme_node = st_widget_get_theme_node (ST_WIDGET (self)); clutter_actor_get_allocation_box (self, &alloc_box); st_theme_node_get_paint_box (theme_node, &alloc_box, &paint_box); origin.x = paint_box.x1 - alloc_box.x1; origin.y = paint_box.y1 - alloc_box.y1; origin.z = 0.0f; clutter_paint_volume_set_origin (volume, &origin); clutter_paint_volume_set_width (volume, paint_box.x2 - paint_box.x1); clutter_paint_volume_set_height (volume, paint_box.y2 - paint_box.y1); if (!clutter_actor_get_clip_to_allocation (self)) { ClutterActor *child; /* Based on ClutterGroup/ClutterBox; include the children's * paint volumes, since they may paint outside our allocation. */ for (child = clutter_actor_get_first_child (self); child != NULL; child = clutter_actor_get_next_sibling (child)) { const ClutterPaintVolume *child_volume; if (!CLUTTER_ACTOR_IS_VISIBLE (child)) continue; if (shell_generic_container_get_skip_paint (SHELL_GENERIC_CONTAINER (self), child)) continue; child_volume = clutter_actor_get_transformed_paint_volume (child, self); if (!child_volume) return FALSE; clutter_paint_volume_union (volume, child_volume); } } return TRUE; }
static void mx_table_paint (ClutterActor *self) { MxTablePrivate *priv = MX_TABLE (self)->priv; ClutterActorIter iter; ClutterActor *child; /* make sure the background gets painted first */ CLUTTER_ACTOR_CLASS (mx_table_parent_class)->paint (self); clutter_actor_iter_init (&iter, self); while (clutter_actor_iter_next (&iter, &child)) { if (CLUTTER_ACTOR_IS_VISIBLE (child)) clutter_actor_paint (child); } if (_mx_debug (MX_DEBUG_LAYOUT)) { int i; float width, height; gfloat pos = 0; DimensionData *rows, *cols; rows = &g_array_index (priv->rows, DimensionData, 0); cols = &g_array_index (priv->columns, DimensionData, 0); clutter_actor_get_size (self, &width, &height); cogl_set_source_color4f (0.0, 0.0, 1.0, 0.7); for (i = 0; i < priv->n_rows; i++) { cogl_rectangle (0, pos, 10, pos + rows[i].final_size); pos += rows[i].final_size + priv->row_spacing; } cogl_set_source_color4f (1.0, 0.0, 0.0, 0.7); pos = 0; for (i = 0; i < priv->n_rows; i++) { cogl_rectangle (pos, 0, pos + cols[i].final_size, 10); pos += cols[i].final_size + priv->col_spacing; } } }
/* Allocate position and size of actor and its children */ static void _xfdashboard_workspace_selector_allocate(ClutterActor *inActor, const ClutterActorBox *inBox, ClutterAllocationFlags inFlags) { XfdashboardWorkspaceSelector *self=XFDASHBOARD_WORKSPACE_SELECTOR(inActor); XfdashboardWorkspaceSelectorPrivate *priv=self->priv; gfloat availableWidth, availableHeight; gfloat childWidth, childHeight; ClutterActor *child; ClutterActorIter iter; ClutterActorBox childAllocation={ 0, }; /* Chain up to store the allocation of the actor */ CLUTTER_ACTOR_CLASS(xfdashboard_workspace_selector_parent_class)->allocate(inActor, inBox, inFlags); /* Get available size */ clutter_actor_box_get_size(inBox, &availableWidth, &availableHeight); /* Calculate new position and size of visible children */ childAllocation.x1=childAllocation.y1=priv->spacing; clutter_actor_iter_init(&iter, CLUTTER_ACTOR(inActor)); while(clutter_actor_iter_next(&iter, &child)) { /* Is child visible? */ if(!CLUTTER_ACTOR_IS_VISIBLE(child)) continue; /* Calculate new position and size of child */ if(priv->orientation==CLUTTER_ORIENTATION_HORIZONTAL) { childHeight=availableHeight-(2*priv->spacing); clutter_actor_get_preferred_width(child, childHeight, NULL, &childWidth); childAllocation.y1=ceil(MAX(((availableHeight-childHeight))/2.0f, priv->spacing)); childAllocation.y2=floor(childAllocation.y1+childHeight); childAllocation.x2=floor(childAllocation.x1+childWidth); } else { childWidth=availableWidth-(2*priv->spacing); clutter_actor_get_preferred_height(child, childWidth, NULL, &childHeight); childAllocation.x1=ceil(MAX(((availableWidth-childWidth))/2.0f, priv->spacing)); childAllocation.x2=floor(childAllocation.x1+childWidth); childAllocation.y2=floor(childAllocation.y1+childHeight); } clutter_actor_allocate(child, &childAllocation, inFlags); /* Set up for next child */ if(priv->orientation==CLUTTER_ORIENTATION_HORIZONTAL) childAllocation.x1=floor(childAllocation.x1+childWidth+priv->spacing); else childAllocation.y1=floor(childAllocation.y1+childHeight+priv->spacing); } }