mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 05:50:10 +00:00
Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master See merge request GNOME/gtk!2162
This commit is contained in:
commit
43b9fc6981
@ -2241,12 +2241,23 @@ render_cross_fade_node (GskGLRenderer *self,
|
|||||||
{
|
{
|
||||||
GskRenderNode *start_node = gsk_cross_fade_node_get_start_child (node);
|
GskRenderNode *start_node = gsk_cross_fade_node_get_start_child (node);
|
||||||
GskRenderNode *end_node = gsk_cross_fade_node_get_end_child (node);
|
GskRenderNode *end_node = gsk_cross_fade_node_get_end_child (node);
|
||||||
float progress = gsk_cross_fade_node_get_progress (node);
|
const float progress = gsk_cross_fade_node_get_progress (node);
|
||||||
TextureRegion start_region;
|
TextureRegion start_region;
|
||||||
TextureRegion end_region;
|
TextureRegion end_region;
|
||||||
gboolean is_offscreen1, is_offscreen2;
|
gboolean is_offscreen1, is_offscreen2;
|
||||||
OpCrossFade *op;
|
OpCrossFade *op;
|
||||||
|
|
||||||
|
if (progress <= 0)
|
||||||
|
{
|
||||||
|
gsk_gl_renderer_add_render_ops (self, start_node, builder);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (progress >= 1)
|
||||||
|
{
|
||||||
|
gsk_gl_renderer_add_render_ops (self, end_node, builder);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO: We create 2 textures here as big as the cross-fade node, but both the
|
/* TODO: We create 2 textures here as big as the cross-fade node, but both the
|
||||||
* start and the end node might be a lot smaller than that. */
|
* start and the end node might be a lot smaller than that. */
|
||||||
|
|
||||||
@ -2266,11 +2277,10 @@ render_cross_fade_node (GskGLRenderer *self,
|
|||||||
&end_region, &is_offscreen2,
|
&end_region, &is_offscreen2,
|
||||||
FORCE_OFFSCREEN | RESET_CLIP | RESET_OPACITY))
|
FORCE_OFFSCREEN | RESET_CLIP | RESET_OPACITY))
|
||||||
{
|
{
|
||||||
load_vertex_data_with_region (ops_draw (builder, NULL),
|
const float prev_opacity = ops_set_opacity (builder, builder->current_opacity * progress);
|
||||||
node,
|
gsk_gl_renderer_add_render_ops (self, start_node, builder);
|
||||||
builder,
|
ops_set_opacity (builder, prev_opacity);
|
||||||
&start_region,
|
|
||||||
TRUE);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1171,6 +1171,8 @@ gtk_grid_view_init (GtkGridView *self)
|
|||||||
gtk_list_base_set_anchor_max_widgets (GTK_LIST_BASE (self),
|
gtk_list_base_set_anchor_max_widgets (GTK_LIST_BASE (self),
|
||||||
self->max_columns * GTK_GRID_VIEW_MAX_VISIBLE_ROWS,
|
self->max_columns * GTK_GRID_VIEW_MAX_VISIBLE_ROWS,
|
||||||
self->max_columns);
|
self->max_columns);
|
||||||
|
|
||||||
|
gtk_widget_add_css_class (GTK_WIDGET (self), "view");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3573,12 +3573,15 @@ static void
|
|||||||
gtk_label_unrealize (GtkWidget *widget)
|
gtk_label_unrealize (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GtkLabel *self = GTK_LABEL (widget);
|
GtkLabel *self = GTK_LABEL (widget);
|
||||||
GdkClipboard *clipboard;
|
|
||||||
|
|
||||||
clipboard = gtk_widget_get_primary_clipboard (widget);
|
|
||||||
if (self->select_info &&
|
if (self->select_info &&
|
||||||
gdk_clipboard_get_content (clipboard) == self->select_info->provider)
|
self->select_info->provider)
|
||||||
|
{
|
||||||
|
GdkClipboard *clipboard = gtk_widget_get_primary_clipboard (widget);
|
||||||
|
|
||||||
|
if (gdk_clipboard_get_content (clipboard) == self->select_info->provider)
|
||||||
gdk_clipboard_set_content (clipboard, NULL);
|
gdk_clipboard_set_content (clipboard, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_label_parent_class)->unrealize (widget);
|
GTK_WIDGET_CLASS (gtk_label_parent_class)->unrealize (widget);
|
||||||
}
|
}
|
||||||
|
@ -925,6 +925,8 @@ gtk_list_view_init (GtkListView *self)
|
|||||||
gtk_list_base_set_anchor_max_widgets (GTK_LIST_BASE (self),
|
gtk_list_base_set_anchor_max_widgets (GTK_LIST_BASE (self),
|
||||||
GTK_LIST_VIEW_MAX_LIST_ITEMS,
|
GTK_LIST_VIEW_MAX_LIST_ITEMS,
|
||||||
GTK_LIST_VIEW_EXTRA_ITEMS);
|
GTK_LIST_VIEW_EXTRA_ITEMS);
|
||||||
|
|
||||||
|
gtk_widget_add_css_class (GTK_WIDGET (self), "view");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -250,16 +250,6 @@ G_DEFINE_TYPE_WITH_CODE (GtkRange, gtk_range, GTK_TYPE_WIDGET,
|
|||||||
static guint signals[LAST_SIGNAL];
|
static guint signals[LAST_SIGNAL];
|
||||||
static GParamSpec *properties[LAST_PROP];
|
static GParamSpec *properties[LAST_PROP];
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_range_snapshot (GtkWidget *widget,
|
|
||||||
GtkSnapshot *snapshot)
|
|
||||||
{
|
|
||||||
GtkRange *range = GTK_RANGE (widget);
|
|
||||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
|
||||||
|
|
||||||
gtk_widget_snapshot_child (widget, priv->trough_widget, snapshot);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_range_class_init (GtkRangeClass *class)
|
gtk_range_class_init (GtkRangeClass *class)
|
||||||
{
|
{
|
||||||
@ -275,7 +265,6 @@ gtk_range_class_init (GtkRangeClass *class)
|
|||||||
gobject_class->dispose = gtk_range_dispose;
|
gobject_class->dispose = gtk_range_dispose;
|
||||||
|
|
||||||
widget_class->measure = gtk_range_measure;
|
widget_class->measure = gtk_range_measure;
|
||||||
widget_class->snapshot = gtk_range_snapshot;
|
|
||||||
widget_class->size_allocate = gtk_range_size_allocate;
|
widget_class->size_allocate = gtk_range_size_allocate;
|
||||||
widget_class->unmap = gtk_range_unmap;
|
widget_class->unmap = gtk_range_unmap;
|
||||||
widget_class->direction_changed = gtk_range_direction_changed;
|
widget_class->direction_changed = gtk_range_direction_changed;
|
||||||
|
@ -47,14 +47,12 @@ static void
|
|||||||
gtk_theming_background_snapshot_color (GtkCssBoxes *boxes,
|
gtk_theming_background_snapshot_color (GtkCssBoxes *boxes,
|
||||||
GtkSnapshot *snapshot,
|
GtkSnapshot *snapshot,
|
||||||
const GdkRGBA *bg_color,
|
const GdkRGBA *bg_color,
|
||||||
const GtkCssValue *background_image)
|
guint n_bg_values)
|
||||||
{
|
{
|
||||||
const GskRoundedRect *box;
|
const GskRoundedRect *box;
|
||||||
gint n_values;
|
|
||||||
GtkCssArea clip;
|
GtkCssArea clip;
|
||||||
|
|
||||||
n_values = _gtk_css_array_value_get_n_values (background_image);
|
clip = _gtk_css_area_value_get (_gtk_css_array_value_get_nth (boxes->style->background->background_clip, n_bg_values - 1));
|
||||||
clip = _gtk_css_area_value_get (_gtk_css_array_value_get_nth (boxes->style->background->background_clip, n_values - 1));
|
|
||||||
box = gtk_css_boxes_get_box (boxes, clip);
|
box = gtk_css_boxes_get_box (boxes, clip);
|
||||||
|
|
||||||
if (gsk_rounded_rect_is_rectilinear (box))
|
if (gsk_rounded_rect_is_rectilinear (box))
|
||||||
@ -94,9 +92,6 @@ gtk_theming_background_snapshot_layer (GtkCssBoxes *bg,
|
|||||||
|
|
||||||
pos = _gtk_css_array_value_get_nth (background->background_position, idx);
|
pos = _gtk_css_array_value_get_nth (background->background_position, idx);
|
||||||
repeat = _gtk_css_array_value_get_nth (background->background_repeat, idx);
|
repeat = _gtk_css_array_value_get_nth (background->background_repeat, idx);
|
||||||
hrepeat = _gtk_css_background_repeat_value_get_x (repeat);
|
|
||||||
vrepeat = _gtk_css_background_repeat_value_get_y (repeat);
|
|
||||||
|
|
||||||
|
|
||||||
origin = gtk_css_boxes_get_box (bg,
|
origin = gtk_css_boxes_get_box (bg,
|
||||||
_gtk_css_area_value_get (
|
_gtk_css_area_value_get (
|
||||||
@ -125,8 +120,13 @@ gtk_theming_background_snapshot_layer (GtkCssBoxes *bg,
|
|||||||
/* optimization */
|
/* optimization */
|
||||||
if (image_width == width)
|
if (image_width == width)
|
||||||
hrepeat = GTK_CSS_REPEAT_STYLE_NO_REPEAT;
|
hrepeat = GTK_CSS_REPEAT_STYLE_NO_REPEAT;
|
||||||
|
else
|
||||||
|
hrepeat = _gtk_css_background_repeat_value_get_x (repeat);
|
||||||
|
|
||||||
if (image_height == height)
|
if (image_height == height)
|
||||||
vrepeat = GTK_CSS_REPEAT_STYLE_NO_REPEAT;
|
vrepeat = GTK_CSS_REPEAT_STYLE_NO_REPEAT;
|
||||||
|
else
|
||||||
|
vrepeat = _gtk_css_background_repeat_value_get_y (repeat);
|
||||||
|
|
||||||
gtk_snapshot_push_debug (snapshot, "Layer %u", idx);
|
gtk_snapshot_push_debug (snapshot, "Layer %u", idx);
|
||||||
gtk_snapshot_push_rounded_clip (snapshot, clip);
|
gtk_snapshot_push_rounded_clip (snapshot, clip);
|
||||||
@ -262,7 +262,8 @@ gtk_css_style_snapshot_background (GtkCssBoxes *boxes,
|
|||||||
gboolean has_bg_color;
|
gboolean has_bg_color;
|
||||||
gboolean has_bg_image;
|
gboolean has_bg_image;
|
||||||
gboolean has_shadow;
|
gboolean has_shadow;
|
||||||
gint idx;
|
int idx;
|
||||||
|
guint number_of_layers;
|
||||||
|
|
||||||
if (background->base.type == GTK_CSS_BACKGROUND_INITIAL_VALUES)
|
if (background->base.type == GTK_CSS_BACKGROUND_INITIAL_VALUES)
|
||||||
return;
|
return;
|
||||||
@ -286,10 +287,11 @@ gtk_css_style_snapshot_background (GtkCssBoxes *boxes,
|
|||||||
snapshot,
|
snapshot,
|
||||||
gtk_css_boxes_get_border_box (boxes));
|
gtk_css_boxes_get_border_box (boxes));
|
||||||
|
|
||||||
|
number_of_layers = _gtk_css_array_value_get_n_values (background_image);
|
||||||
|
|
||||||
if (has_bg_image)
|
if (has_bg_image)
|
||||||
{
|
{
|
||||||
GtkCssValue *blend_modes = background->background_blend_mode;
|
GtkCssValue *blend_modes = background->background_blend_mode;
|
||||||
const int number_of_layers = _gtk_css_array_value_get_n_values (background_image);
|
|
||||||
GskBlendMode *blend_mode_values = g_alloca (sizeof (GskBlendMode) * number_of_layers);
|
GskBlendMode *blend_mode_values = g_alloca (sizeof (GskBlendMode) * number_of_layers);
|
||||||
|
|
||||||
for (idx = number_of_layers - 1; idx >= 0; idx--)
|
for (idx = number_of_layers - 1; idx >= 0; idx--)
|
||||||
@ -301,7 +303,7 @@ gtk_css_style_snapshot_background (GtkCssBoxes *boxes,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (has_bg_color)
|
if (has_bg_color)
|
||||||
gtk_theming_background_snapshot_color (boxes, snapshot, bg_color, background_image);
|
gtk_theming_background_snapshot_color (boxes, snapshot, bg_color, number_of_layers);
|
||||||
|
|
||||||
for (idx = number_of_layers - 1; idx >= 0; idx--)
|
for (idx = number_of_layers - 1; idx >= 0; idx--)
|
||||||
{
|
{
|
||||||
@ -319,7 +321,7 @@ gtk_css_style_snapshot_background (GtkCssBoxes *boxes,
|
|||||||
}
|
}
|
||||||
else if (has_bg_color)
|
else if (has_bg_color)
|
||||||
{
|
{
|
||||||
gtk_theming_background_snapshot_color (boxes, snapshot, bg_color, background_image);
|
gtk_theming_background_snapshot_color (boxes, snapshot, bg_color, number_of_layers);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_shadow)
|
if (has_shadow)
|
||||||
|
@ -79,22 +79,23 @@
|
|||||||
*
|
*
|
||||||
* |[<!-- language="plain" -->
|
* |[<!-- language="plain" -->
|
||||||
* scale[.fine-tune][.marks-before][.marks-after]
|
* scale[.fine-tune][.marks-before][.marks-after]
|
||||||
|
* ├── [value][.top][.right][.bottom][.left]
|
||||||
* ├── marks.top
|
* ├── marks.top
|
||||||
* │ ├── mark
|
* │ ├── mark
|
||||||
* │ ┊ ├── [label]
|
* │ ┊ ├── [label]
|
||||||
* │ ┊ ╰── indicator
|
* │ ┊ ╰── indicator
|
||||||
* ┊ ┊
|
* ┊ ┊
|
||||||
* │ ╰── mark
|
* │ ╰── mark
|
||||||
* ├── [value][.top][.right][.bottom][.left]
|
* ├── marks.bottom
|
||||||
* ├── trough
|
* │ ├── mark
|
||||||
* │ ├── [fill]
|
* │ ┊ ├── indicator
|
||||||
* │ ├── [highlight]
|
* │ ┊ ╰── [label]
|
||||||
* │ ╰── slider
|
* ┊ ┊
|
||||||
* ╰── marks.bottom
|
* │ ╰── mark
|
||||||
* ├── mark
|
* ╰── trough
|
||||||
* ┊ ├── indicator
|
* ├── [fill]
|
||||||
* ┊ ╰── [label]
|
* ├── [highlight]
|
||||||
* ╰── mark
|
* ╰── slider
|
||||||
* ]|
|
* ]|
|
||||||
*
|
*
|
||||||
* GtkScale has a main CSS node with name scale and a subnode for its contents,
|
* GtkScale has a main CSS node with name scale and a subnode for its contents,
|
||||||
@ -197,8 +198,6 @@ static void gtk_scale_measure (GtkWidget *widget,
|
|||||||
static void gtk_scale_get_range_border (GtkRange *range,
|
static void gtk_scale_get_range_border (GtkRange *range,
|
||||||
GtkBorder *border);
|
GtkBorder *border);
|
||||||
static void gtk_scale_finalize (GObject *object);
|
static void gtk_scale_finalize (GObject *object);
|
||||||
static void gtk_scale_snapshot (GtkWidget *widget,
|
|
||||||
GtkSnapshot *snapshot);
|
|
||||||
static void gtk_scale_real_get_layout_offsets (GtkScale *scale,
|
static void gtk_scale_real_get_layout_offsets (GtkScale *scale,
|
||||||
gint *x,
|
gint *x,
|
||||||
gint *y);
|
gint *y);
|
||||||
@ -661,7 +660,6 @@ gtk_scale_class_init (GtkScaleClass *class)
|
|||||||
gobject_class->notify = gtk_scale_notify;
|
gobject_class->notify = gtk_scale_notify;
|
||||||
gobject_class->finalize = gtk_scale_finalize;
|
gobject_class->finalize = gtk_scale_finalize;
|
||||||
|
|
||||||
widget_class->snapshot = gtk_scale_snapshot;
|
|
||||||
widget_class->size_allocate = gtk_scale_size_allocate;
|
widget_class->size_allocate = gtk_scale_size_allocate;
|
||||||
widget_class->measure = gtk_scale_measure;
|
widget_class->measure = gtk_scale_measure;
|
||||||
widget_class->grab_focus = gtk_widget_grab_focus_self;
|
widget_class->grab_focus = gtk_widget_grab_focus_self;
|
||||||
@ -1093,14 +1091,9 @@ gtk_scale_set_draw_value (GtkScale *scale,
|
|||||||
"css-name", "value",
|
"css-name", "value",
|
||||||
"label", txt,
|
"label", txt,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_free (txt);
|
g_free (txt);
|
||||||
|
|
||||||
if (priv->value_pos == GTK_POS_TOP || priv->value_pos == GTK_POS_LEFT)
|
|
||||||
gtk_widget_insert_after (priv->value_widget, GTK_WIDGET (scale), NULL);
|
gtk_widget_insert_after (priv->value_widget, GTK_WIDGET (scale), NULL);
|
||||||
else
|
|
||||||
gtk_widget_insert_before (priv->value_widget, GTK_WIDGET (scale), NULL);
|
|
||||||
|
|
||||||
gtk_range_set_round_digits (GTK_RANGE (scale), priv->digits);
|
gtk_range_set_round_digits (GTK_RANGE (scale), priv->digits);
|
||||||
update_value_position (scale);
|
update_value_position (scale);
|
||||||
update_label_request (scale);
|
update_label_request (scale);
|
||||||
@ -1469,25 +1462,6 @@ gtk_scale_measure (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_scale_snapshot (GtkWidget *widget,
|
|
||||||
GtkSnapshot *snapshot)
|
|
||||||
{
|
|
||||||
GtkScale *scale = GTK_SCALE (widget);
|
|
||||||
GtkScalePrivate *priv = gtk_scale_get_instance_private (scale);
|
|
||||||
|
|
||||||
if (priv->top_marks_widget)
|
|
||||||
gtk_widget_snapshot_child (widget, priv->top_marks_widget, snapshot);
|
|
||||||
|
|
||||||
if (priv->bottom_marks_widget)
|
|
||||||
gtk_widget_snapshot_child (widget, priv->bottom_marks_widget, snapshot);
|
|
||||||
|
|
||||||
if (priv->value_widget)
|
|
||||||
gtk_widget_snapshot_child (widget, priv->value_widget, snapshot);
|
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (gtk_scale_parent_class)->snapshot (widget, snapshot);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_scale_real_get_layout_offsets (GtkScale *scale,
|
gtk_scale_real_get_layout_offsets (GtkScale *scale,
|
||||||
gint *x,
|
gint *x,
|
||||||
@ -1722,9 +1696,7 @@ gtk_scale_add_mark (GtkScale *scale,
|
|||||||
|
|
||||||
gtk_widget_insert_after (priv->top_marks_widget,
|
gtk_widget_insert_after (priv->top_marks_widget,
|
||||||
GTK_WIDGET (scale),
|
GTK_WIDGET (scale),
|
||||||
(priv->value_widget &&
|
priv->value_widget);
|
||||||
(priv->value_pos == GTK_POS_TOP || priv->value_pos == GTK_POS_LEFT)) ?
|
|
||||||
priv->value_widget : NULL);
|
|
||||||
gtk_widget_add_css_class (priv->top_marks_widget, GTK_STYLE_CLASS_TOP);
|
gtk_widget_add_css_class (priv->top_marks_widget, GTK_STYLE_CLASS_TOP);
|
||||||
}
|
}
|
||||||
marks_widget = priv->top_marks_widget;
|
marks_widget = priv->top_marks_widget;
|
||||||
@ -1742,9 +1714,7 @@ gtk_scale_add_mark (GtkScale *scale,
|
|||||||
|
|
||||||
gtk_widget_insert_before (priv->bottom_marks_widget,
|
gtk_widget_insert_before (priv->bottom_marks_widget,
|
||||||
GTK_WIDGET (scale),
|
GTK_WIDGET (scale),
|
||||||
(priv->value_widget &&
|
gtk_range_get_trough_widget (GTK_RANGE (scale)));
|
||||||
(priv->value_pos == GTK_POS_BOTTOM || priv->value_pos == GTK_POS_RIGHT)) ?
|
|
||||||
priv->value_widget: NULL);
|
|
||||||
gtk_widget_add_css_class (priv->bottom_marks_widget, GTK_STYLE_CLASS_BOTTOM);
|
gtk_widget_add_css_class (priv->bottom_marks_widget, GTK_STYLE_CLASS_BOTTOM);
|
||||||
}
|
}
|
||||||
marks_widget = priv->bottom_marks_widget;
|
marks_widget = priv->bottom_marks_widget;
|
||||||
|
@ -143,7 +143,6 @@
|
|||||||
#define SCREEN_HEIGHT(widget) text_window_get_height (GTK_TEXT_VIEW (widget)->priv->text_window)
|
#define SCREEN_HEIGHT(widget) text_window_get_height (GTK_TEXT_VIEW (widget)->priv->text_window)
|
||||||
|
|
||||||
#define SPACE_FOR_CURSOR 1
|
#define SPACE_FOR_CURSOR 1
|
||||||
#define CURSOR_ASPECT_RATIO (0.04)
|
|
||||||
|
|
||||||
typedef struct _GtkTextWindow GtkTextWindow;
|
typedef struct _GtkTextWindow GtkTextWindow;
|
||||||
typedef struct _GtkTextPendingScroll GtkTextPendingScroll;
|
typedef struct _GtkTextPendingScroll GtkTextPendingScroll;
|
||||||
|
@ -7377,14 +7377,14 @@ static void
|
|||||||
gtk_widget_real_realize (GtkWidget *widget)
|
gtk_widget_real_realize (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||||
GdkFrameClock *frame_clock;
|
|
||||||
|
|
||||||
priv->realized = TRUE;
|
priv->realized = TRUE;
|
||||||
|
|
||||||
/* Connect frame clock */
|
/* Connect frame clock */
|
||||||
frame_clock = gtk_widget_get_frame_clock (widget);
|
|
||||||
if (priv->tick_callbacks != NULL && !priv->clock_tick_id)
|
if (priv->tick_callbacks != NULL && !priv->clock_tick_id)
|
||||||
{
|
{
|
||||||
|
GdkFrameClock *frame_clock = gtk_widget_get_frame_clock (widget);
|
||||||
|
|
||||||
priv->clock_tick_id = g_signal_connect (frame_clock, "update",
|
priv->clock_tick_id = g_signal_connect (frame_clock, "update",
|
||||||
G_CALLBACK (gtk_widget_on_frame_clock_update),
|
G_CALLBACK (gtk_widget_on_frame_clock_update),
|
||||||
widget);
|
widget);
|
||||||
|
@ -385,8 +385,6 @@ recordings_list_row_selected (GtkListBox *box,
|
|||||||
(gpointer[1]) { paintable },
|
(gpointer[1]) { paintable },
|
||||||
1);
|
1);
|
||||||
g_object_unref (paintable);
|
g_object_unref (paintable);
|
||||||
|
|
||||||
g_print ("%u render nodes\n", g_list_model_get_n_items (G_LIST_MODEL (priv->render_node_model)));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -405,9 +403,9 @@ get_color_texture (const GdkRGBA *color)
|
|||||||
guchar pixel[4];
|
guchar pixel[4];
|
||||||
guchar *data;
|
guchar *data;
|
||||||
GBytes *bytes;
|
GBytes *bytes;
|
||||||
gint width = 30;
|
int width = 30;
|
||||||
gint height = 30;
|
int height = 30;
|
||||||
gint i;
|
int i;
|
||||||
|
|
||||||
pixel[0] = round (color->red * 255);
|
pixel[0] = round (color->red * 255);
|
||||||
pixel[1] = round (color->green * 255);
|
pixel[1] = round (color->green * 255);
|
||||||
@ -950,7 +948,7 @@ render_node_list_selection_changed (GtkListBox *list,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
render_node_save_response (GtkWidget *dialog,
|
render_node_save_response (GtkWidget *dialog,
|
||||||
gint response,
|
int response,
|
||||||
GskRenderNode *node)
|
GskRenderNode *node)
|
||||||
{
|
{
|
||||||
gtk_widget_hide (dialog);
|
gtk_widget_hide (dialog);
|
||||||
@ -1019,83 +1017,33 @@ render_node_save (GtkButton *button,
|
|||||||
gtk_widget_show (dialog);
|
gtk_widget_show (dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
|
||||||
format_timespan (gint64 timespan)
|
|
||||||
{
|
|
||||||
if (ABS (timespan) < G_TIME_SPAN_MILLISECOND)
|
|
||||||
return g_strdup_printf ("%fus", (double) timespan);
|
|
||||||
else if (ABS (timespan) < 10 * G_TIME_SPAN_MILLISECOND)
|
|
||||||
return g_strdup_printf ("%.1fs", (double) timespan / G_TIME_SPAN_MILLISECOND);
|
|
||||||
else if (ABS (timespan) < G_TIME_SPAN_SECOND)
|
|
||||||
return g_strdup_printf ("%.0fms", (double) timespan / G_TIME_SPAN_MILLISECOND);
|
|
||||||
else if (ABS (timespan) < 10 * G_TIME_SPAN_SECOND)
|
|
||||||
return g_strdup_printf ("%.1fs", (double) timespan / G_TIME_SPAN_SECOND);
|
|
||||||
else
|
|
||||||
return g_strdup_printf ("%.0fs", (double) timespan / G_TIME_SPAN_SECOND);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
gtk_inspector_recorder_recordings_list_create_widget (gpointer item,
|
gtk_inspector_recorder_recordings_list_create_widget (gpointer item,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkInspectorRecorder *recorder = GTK_INSPECTOR_RECORDER (user_data);
|
|
||||||
GtkInspectorRecorderPrivate *priv = gtk_inspector_recorder_get_instance_private (recorder);
|
|
||||||
GtkInspectorRecording *recording = GTK_INSPECTOR_RECORDING (item);
|
GtkInspectorRecording *recording = GTK_INSPECTOR_RECORDING (item);
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
|
|
||||||
if (GTK_INSPECTOR_IS_RENDER_RECORDING (recording))
|
if (GTK_INSPECTOR_IS_RENDER_RECORDING (recording))
|
||||||
{
|
{
|
||||||
GtkInspectorRecording *previous = NULL;
|
|
||||||
char *time_str, *str;
|
|
||||||
const char *render_str;
|
|
||||||
cairo_region_t *region;
|
cairo_region_t *region;
|
||||||
GtkWidget *hbox, *label, *button;
|
GtkWidget *hbox, *label, *button;
|
||||||
guint i;
|
|
||||||
|
|
||||||
widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||||
|
|
||||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||||
gtk_box_append (GTK_BOX (widget), hbox);
|
gtk_box_append (GTK_BOX (widget), hbox);
|
||||||
|
|
||||||
for (i = 0; i < g_list_model_get_n_items (priv->recordings); i++)
|
|
||||||
{
|
|
||||||
GtkInspectorRecording *r = g_list_model_get_item (priv->recordings, i);
|
|
||||||
|
|
||||||
g_object_unref (r);
|
|
||||||
|
|
||||||
if (r == recording)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (GTK_INSPECTOR_IS_RENDER_RECORDING (r))
|
|
||||||
previous = r;
|
|
||||||
else if (GTK_INSPECTOR_IS_START_RECORDING (r))
|
|
||||||
previous = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
region = cairo_region_create_rectangle (
|
region = cairo_region_create_rectangle (
|
||||||
gtk_inspector_render_recording_get_area (GTK_INSPECTOR_RENDER_RECORDING (recording)));
|
gtk_inspector_render_recording_get_area (GTK_INSPECTOR_RENDER_RECORDING (recording)));
|
||||||
cairo_region_subtract (region,
|
cairo_region_subtract (region,
|
||||||
gtk_inspector_render_recording_get_clip_region (GTK_INSPECTOR_RENDER_RECORDING (recording)));
|
gtk_inspector_render_recording_get_clip_region (GTK_INSPECTOR_RENDER_RECORDING (recording)));
|
||||||
if (cairo_region_is_empty (region))
|
|
||||||
render_str = "Full Render";
|
|
||||||
else
|
|
||||||
render_str = "Partial Render";
|
|
||||||
cairo_region_destroy (region);
|
cairo_region_destroy (region);
|
||||||
|
|
||||||
if (previous)
|
label = gtk_label_new ("<b>Frame</b>");
|
||||||
{
|
gtk_label_set_xalign (GTK_LABEL (label), 0.0f);
|
||||||
time_str = format_timespan (gtk_inspector_recording_get_timestamp (recording) -
|
gtk_widget_set_hexpand (label, TRUE);
|
||||||
gtk_inspector_recording_get_timestamp (previous));
|
|
||||||
str = g_strdup_printf ("<b>%s</b>\n+%s", render_str, time_str);
|
|
||||||
g_free (time_str);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
str = g_strdup_printf ("<b>%s</b>\n", render_str);
|
|
||||||
}
|
|
||||||
label = gtk_label_new (str);
|
|
||||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||||
g_free (str);
|
|
||||||
gtk_box_append (GTK_BOX (hbox), label);
|
gtk_box_append (GTK_BOX (hbox), label);
|
||||||
|
|
||||||
button = gtk_toggle_button_new ();
|
button = gtk_toggle_button_new ();
|
||||||
@ -1311,24 +1259,8 @@ gtk_inspector_recorder_add_recording (GtkInspectorRecorder *recorder,
|
|||||||
GtkInspectorRecording *recording)
|
GtkInspectorRecording *recording)
|
||||||
{
|
{
|
||||||
GtkInspectorRecorderPrivate *priv = gtk_inspector_recorder_get_instance_private (recorder);
|
GtkInspectorRecorderPrivate *priv = gtk_inspector_recorder_get_instance_private (recorder);
|
||||||
guint count;
|
|
||||||
GtkListBoxRow *selected_row;
|
|
||||||
gboolean should_select_new_row;
|
|
||||||
|
|
||||||
count = g_list_model_get_n_items (priv->recordings);
|
|
||||||
selected_row = gtk_list_box_get_selected_row (GTK_LIST_BOX (priv->recordings_list));
|
|
||||||
if (count == 0 || selected_row == NULL)
|
|
||||||
should_select_new_row = TRUE;
|
|
||||||
else
|
|
||||||
should_select_new_row = (gtk_list_box_row_get_index (selected_row) == count - 1);
|
|
||||||
|
|
||||||
g_list_store_append (G_LIST_STORE (priv->recordings), recording);
|
g_list_store_append (G_LIST_STORE (priv->recordings), recording);
|
||||||
|
|
||||||
if (should_select_new_row)
|
|
||||||
{
|
|
||||||
gtk_list_box_select_row (GTK_LIST_BOX (priv->recordings_list),
|
|
||||||
gtk_list_box_get_row_at_index (GTK_LIST_BOX (priv->recordings_list), count));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -35,17 +35,14 @@ window.background:dir(ltr)
|
|||||||
mark:dir(ltr)
|
mark:dir(ltr)
|
||||||
label:dir(ltr)
|
label:dir(ltr)
|
||||||
indicator:dir(ltr)
|
indicator:dir(ltr)
|
||||||
trough:dir(ltr)
|
|
||||||
highlight.top:dir(ltr)
|
|
||||||
slider:dir(ltr)
|
|
||||||
marks.bottom:dir(ltr)
|
marks.bottom:dir(ltr)
|
||||||
mark:dir(ltr)
|
mark:dir(ltr)
|
||||||
indicator:dir(ltr)
|
indicator:dir(ltr)
|
||||||
label:dir(ltr)
|
label:dir(ltr)
|
||||||
|
trough:dir(ltr)
|
||||||
|
highlight.top:dir(ltr)
|
||||||
|
slider:dir(ltr)
|
||||||
scale.horizontal.marks-after:dir(ltr)
|
scale.horizontal.marks-after:dir(ltr)
|
||||||
trough:dir(ltr)
|
|
||||||
highlight.top:dir(ltr)
|
|
||||||
slider:dir(ltr)
|
|
||||||
marks.bottom:dir(ltr)
|
marks.bottom:dir(ltr)
|
||||||
mark:dir(ltr)
|
mark:dir(ltr)
|
||||||
indicator:dir(ltr)
|
indicator:dir(ltr)
|
||||||
@ -53,3 +50,6 @@ window.background:dir(ltr)
|
|||||||
mark:dir(ltr)
|
mark:dir(ltr)
|
||||||
indicator:dir(ltr)
|
indicator:dir(ltr)
|
||||||
label:dir(ltr)
|
label:dir(ltr)
|
||||||
|
trough:dir(ltr)
|
||||||
|
highlight.top:dir(ltr)
|
||||||
|
slider:dir(ltr)
|
||||||
|
Loading…
Reference in New Issue
Block a user