forked from AuroraMiddleware/gtk
Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master Closes #3282 See merge request GNOME/gtk!2755
This commit is contained in:
commit
d5b9489408
@ -113,12 +113,9 @@ apply_transform (CanvasItem *item)
|
||||
y = gtk_widget_get_allocated_height (item->label) / 2.0;
|
||||
item->r = sqrt (x*x + y*y);
|
||||
|
||||
transform = gsk_transform_translate (
|
||||
gsk_transform_rotate (
|
||||
gsk_transform_translate (NULL,
|
||||
&(graphene_point_t) { item->r, item->r }),
|
||||
item->angle + item->delta),
|
||||
&(graphene_point_t) { - x, - y });
|
||||
transform = gsk_transform_translate (NULL, &(graphene_point_t) { item->r, item->r });
|
||||
transform = gsk_transform_rotate (transform, item->angle + item->delta);
|
||||
transform = gsk_transform_translate (transform, &(graphene_point_t) { -x, -y });
|
||||
|
||||
gtk_fixed_set_child_transform (GTK_FIXED (item->fixed), item->label, transform);
|
||||
gsk_transform_unref (transform);
|
||||
|
@ -1068,7 +1068,6 @@ update_font_variations (void)
|
||||
unsigned int length;
|
||||
int i;
|
||||
|
||||
child = gtk_widget_get_first_child (variations_grid);
|
||||
while ((child = gtk_widget_get_first_child (variations_grid)))
|
||||
gtk_grid_remove (GTK_GRID (variations_grid), child);
|
||||
|
||||
|
@ -164,7 +164,7 @@ save_file (GFile *save_filename)
|
||||
NULL,
|
||||
&error);
|
||||
|
||||
if (error != NULL)
|
||||
if (error == NULL)
|
||||
{
|
||||
if (save_filename != filename)
|
||||
{
|
||||
|
@ -2051,6 +2051,9 @@ update_cursor (GdkDisplay *display,
|
||||
GdkDeviceGrabInfo *grab;
|
||||
GdkCursor *cursor;
|
||||
|
||||
g_assert (display);
|
||||
g_assert (device);
|
||||
|
||||
pointer_info = _gdk_display_get_pointer_info (display, device);
|
||||
pointer_surface = pointer_info->surface_under_pointer;
|
||||
|
||||
|
@ -1914,22 +1914,25 @@ blur_node (GskGLRenderer *self,
|
||||
texture_width = ceilf ((node->bounds.size.width + blur_extra));
|
||||
texture_height = ceilf ((node->bounds.size.height + blur_extra));
|
||||
|
||||
if (!add_offscreen_ops (self, builder,
|
||||
&GRAPHENE_RECT_INIT (node->bounds.origin.x - (blur_extra / 2.0),
|
||||
node->bounds.origin.y - (blur_extra /2.0),
|
||||
texture_width, texture_height),
|
||||
node,
|
||||
®ion, &is_offscreen,
|
||||
RESET_CLIP | RESET_OPACITY | FORCE_OFFSCREEN | extra_flags))
|
||||
g_assert_not_reached ();
|
||||
/* Only blur this if the out region has no texture id yet */
|
||||
if (out_region->texture_id == 0)
|
||||
{
|
||||
if (!add_offscreen_ops (self, builder,
|
||||
&GRAPHENE_RECT_INIT (node->bounds.origin.x - (blur_extra / 2.0),
|
||||
node->bounds.origin.y - (blur_extra / 2.0),
|
||||
texture_width, texture_height),
|
||||
node,
|
||||
®ion, &is_offscreen,
|
||||
RESET_CLIP | RESET_OPACITY | FORCE_OFFSCREEN | extra_flags))
|
||||
g_assert_not_reached ();
|
||||
|
||||
blurred_texture_id = blur_texture (self, builder,
|
||||
®ion,
|
||||
texture_width * scale_x, texture_height * scale_y,
|
||||
blur_radius * scale_x,
|
||||
blur_radius * scale_y);
|
||||
|
||||
init_full_texture_region (out_region, blurred_texture_id);
|
||||
blurred_texture_id = blur_texture (self, builder,
|
||||
®ion,
|
||||
texture_width * scale_x, texture_height * scale_y,
|
||||
blur_radius * scale_x,
|
||||
blur_radius * scale_y);
|
||||
init_full_texture_region (out_region, blurred_texture_id);
|
||||
}
|
||||
|
||||
if (out_vertex_data)
|
||||
{
|
||||
@ -1949,6 +1952,7 @@ render_blur_node (GskGLRenderer *self,
|
||||
GskRenderNode *child = gsk_blur_node_get_child (node);
|
||||
TextureRegion blurred_region;
|
||||
GskTextureKey key;
|
||||
float min_x, max_x, min_y, max_y;
|
||||
|
||||
if (node_is_invisible (child))
|
||||
return;
|
||||
@ -1964,15 +1968,16 @@ render_blur_node (GskGLRenderer *self,
|
||||
key.scale = ops_get_scale (builder);
|
||||
key.filter = GL_NEAREST;
|
||||
blurred_region.texture_id = gsk_gl_driver_get_texture_for_key (self->gl_driver, &key);
|
||||
if (blurred_region.texture_id == 0)
|
||||
blur_node (self, child, builder, blur_radius, 0, &blurred_region, NULL);
|
||||
blur_node (self, child, builder, blur_radius, 0, &blurred_region,
|
||||
(float*[4]){&min_x, &max_x, &min_y, &max_y});
|
||||
|
||||
g_assert (blurred_region.texture_id != 0);
|
||||
|
||||
/* Draw the result */
|
||||
ops_set_program (builder, &self->programs->blit_program);
|
||||
ops_set_texture (builder, blurred_region.texture_id);
|
||||
load_offscreen_vertex_data (ops_draw (builder, NULL), node, builder); /* Render result to screen */
|
||||
fill_vertex_data (ops_draw (builder, NULL), min_x, min_y, max_x, max_y);
|
||||
|
||||
|
||||
/* Add to cache for the blur node */
|
||||
gsk_gl_driver_set_texture_for_key (self->gl_driver, &key, blurred_region.texture_id);
|
||||
@ -2390,7 +2395,7 @@ render_outset_shadow_node (GskGLRenderer *self,
|
||||
if (slice_is_visible (&slices[NINE_SLICE_TOP_CENTER]))
|
||||
{
|
||||
x1 = min_x + (slices[NINE_SLICE_TOP_LEFT].width / scale_x);
|
||||
x2 = max_x - (slices[NINE_SLICE_TOP_RIGHT].width / scale_y);
|
||||
x2 = max_x - (slices[NINE_SLICE_TOP_RIGHT].width / scale_x);
|
||||
y1 = min_y;
|
||||
y2 = min_y + (slices[NINE_SLICE_TOP_CENTER].height / scale_y);
|
||||
|
||||
@ -2487,7 +2492,7 @@ render_outset_shadow_node (GskGLRenderer *self,
|
||||
{
|
||||
x1 = min_x;
|
||||
x2 = min_x + (slices[NINE_SLICE_LEFT_CENTER].width / scale_x);
|
||||
y1 = min_y + (slices[NINE_SLICE_TOP_LEFT].height / scale_x);
|
||||
y1 = min_y + (slices[NINE_SLICE_TOP_LEFT].height / scale_y);
|
||||
y2 = max_y - (slices[NINE_SLICE_BOTTOM_LEFT].height / scale_y);
|
||||
tx1 = tregs[NINE_SLICE_LEFT_CENTER].x;
|
||||
tx2 = tregs[NINE_SLICE_LEFT_CENTER].x2;
|
||||
@ -2631,6 +2636,7 @@ render_shadow_node (GskGLRenderer *self,
|
||||
|
||||
if (shadow->radius > 0)
|
||||
{
|
||||
region.texture_id = 0;
|
||||
blur_node (self, shadow_child, builder, shadow->radius, NO_CACHE_PLZ, ®ion,
|
||||
(float*[4]){&min_x, &max_x, &min_y, &max_y});
|
||||
is_offscreen = TRUE;
|
||||
|
@ -895,6 +895,7 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
|
||||
case GTK_ACCESSIBLE_TRISTATE_FALSE:
|
||||
emit_state_changed (self, "checked", FALSE);
|
||||
emit_state_changed (self, "indeterminate", FALSE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -930,6 +931,7 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
|
||||
break;
|
||||
case GTK_ACCESSIBLE_INVALID_FALSE:
|
||||
emit_state_changed (self, "invalid", FALSE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -951,6 +953,7 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
|
||||
case GTK_ACCESSIBLE_TRISTATE_FALSE:
|
||||
emit_state_changed (self, "pressed", FALSE);
|
||||
emit_state_changed (self, "indeterminate", FALSE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ gtk_text_view_add_default_attributes (GtkTextView *view,
|
||||
g_variant_builder_add (builder, "{ss}", "direction",
|
||||
gtk_text_direction_to_string (text_attrs->direction));
|
||||
g_variant_builder_add (builder, "{ss}", "wrap-mode",
|
||||
pango_wrap_mode_to_string (text_attrs->wrap_mode));
|
||||
pango_wrap_mode_to_string ((PangoWrapMode)text_attrs->wrap_mode));
|
||||
g_variant_builder_add (builder, "{ss}", "editable",
|
||||
text_attrs->editable ? "true" : "false");
|
||||
g_variant_builder_add (builder, "{ss}", "invisible",
|
||||
@ -256,7 +256,7 @@ gtk_text_buffer_get_run_attributes (GtkTextBuffer *buffer,
|
||||
"wrap-mode", &wrap_mode,
|
||||
NULL);
|
||||
if (val_set)
|
||||
g_variant_builder_add (builder, "{ss}", "wrap-mode", pango_wrap_mode_to_string (wrap_mode));
|
||||
g_variant_builder_add (builder, "{ss}", "wrap-mode", pango_wrap_mode_to_string ((PangoWrapMode)wrap_mode));
|
||||
temp_tags = temp_tags->next;
|
||||
}
|
||||
val_set = FALSE;
|
||||
|
@ -619,11 +619,11 @@ gtk_file_chooser_widget_finalize (GObject *object)
|
||||
static GtkWindow *
|
||||
get_toplevel (GtkWidget *widget)
|
||||
{
|
||||
GtkWidget *toplevel;
|
||||
GtkRoot *root;
|
||||
|
||||
toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
|
||||
if (GTK_IS_WINDOW (toplevel))
|
||||
return GTK_WINDOW (toplevel);
|
||||
root = gtk_widget_get_root (widget);
|
||||
if (root && GTK_IS_WINDOW (root))
|
||||
return GTK_WINDOW (root);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
@ -5395,6 +5395,10 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
|
||||
if (impl->operation_mode == OPERATION_MODE_SEARCH)
|
||||
return get_selected_files_as_model (impl);
|
||||
|
||||
info.impl = impl;
|
||||
info.result = g_list_store_new (G_TYPE_FILE);
|
||||
info.file_from_entry = NULL;
|
||||
|
||||
if (impl->operation_mode == OPERATION_MODE_RECENT)
|
||||
{
|
||||
if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
|
||||
@ -5403,13 +5407,12 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
|
||||
goto file_entry;
|
||||
}
|
||||
else
|
||||
return get_selected_files_as_model (impl);
|
||||
{
|
||||
g_object_unref (info.result);
|
||||
return get_selected_files_as_model (impl);
|
||||
}
|
||||
}
|
||||
|
||||
info.impl = impl;
|
||||
info.result = g_list_store_new (G_TYPE_FILE);
|
||||
info.file_from_entry = NULL;
|
||||
|
||||
toplevel = get_toplevel (GTK_WIDGET (impl));
|
||||
if (toplevel)
|
||||
current_focus = gtk_root_get_focus (GTK_ROOT (toplevel));
|
||||
|
@ -2337,7 +2337,10 @@ no_uline:
|
||||
char *text_for_accel;
|
||||
|
||||
if (!pango_parse_markup (str_for_display, -1, 0, NULL, &text_for_accel, NULL, &error))
|
||||
goto error_set;
|
||||
{
|
||||
g_free (new_text);
|
||||
goto error_set;
|
||||
}
|
||||
|
||||
extract_mnemonic_keyval (text_for_accel,
|
||||
NULL,
|
||||
|
@ -2165,6 +2165,9 @@ gtk_stack_snapshot_cube (GtkWidget *widget,
|
||||
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
|
||||
double progress = gtk_progress_tracker_get_progress (&priv->tracker, FALSE);
|
||||
|
||||
g_assert (priv->active_transition_type == GTK_STACK_TRANSITION_TYPE_ROTATE_RIGHT ||
|
||||
priv->active_transition_type == GTK_STACK_TRANSITION_TYPE_ROTATE_LEFT);
|
||||
|
||||
if (priv->active_transition_type == GTK_STACK_TRANSITION_TYPE_ROTATE_RIGHT)
|
||||
progress = 1 - progress;
|
||||
|
||||
|
120
gtk/gtktext.c
120
gtk/gtktext.c
@ -329,8 +329,6 @@ static void gtk_text_size_allocate (GtkWidget *widget,
|
||||
int baseline);
|
||||
static void gtk_text_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot);
|
||||
static void gtk_text_focus_in (GtkWidget *widget);
|
||||
static void gtk_text_focus_out (GtkWidget *widget);
|
||||
static void gtk_text_focus_changed (GtkEventControllerFocus *focus,
|
||||
GParamSpec *pspec,
|
||||
GtkWidget *widget);
|
||||
@ -341,7 +339,6 @@ static void gtk_text_direction_changed (GtkWidget *widget,
|
||||
GtkTextDirection previous_dir);
|
||||
static void gtk_text_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state);
|
||||
static void gtk_text_root (GtkWidget *widget);
|
||||
|
||||
static gboolean gtk_text_drag_drop (GtkDropTarget *dest,
|
||||
const GValue *value,
|
||||
@ -728,7 +725,6 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
widget_class->css_changed = gtk_text_css_changed;
|
||||
widget_class->direction_changed = gtk_text_direction_changed;
|
||||
widget_class->state_flags_changed = gtk_text_state_flags_changed;
|
||||
widget_class->root = gtk_text_root;
|
||||
widget_class->mnemonic_activate = gtk_text_mnemonic_activate;
|
||||
|
||||
class->move_cursor = gtk_text_move_cursor;
|
||||
@ -3152,73 +3148,54 @@ gtk_text_key_controller_key_pressed (GtkEventControllerKey *controller,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_focus_in (GtkWidget *widget)
|
||||
{
|
||||
GtkText *self = GTK_TEXT (widget);
|
||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||
GdkSeat *seat = NULL;
|
||||
GdkDevice *keyboard = NULL;
|
||||
|
||||
gtk_widget_queue_draw (widget);
|
||||
|
||||
seat = gdk_display_get_default_seat (gtk_widget_get_display (widget));
|
||||
if (seat)
|
||||
keyboard = gdk_seat_get_keyboard (seat);
|
||||
if (keyboard)
|
||||
g_signal_connect (keyboard, "notify::direction",
|
||||
G_CALLBACK (direction_changed), self);
|
||||
|
||||
|
||||
if (priv->editable)
|
||||
{
|
||||
gtk_text_schedule_im_reset (self);
|
||||
gtk_im_context_focus_in (priv->im_context);
|
||||
}
|
||||
|
||||
gtk_text_reset_blink_time (self);
|
||||
gtk_text_check_cursor_blink (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_focus_out (GtkWidget *widget)
|
||||
{
|
||||
GtkText *self = GTK_TEXT (widget);
|
||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||
GdkSeat *seat = NULL;
|
||||
GdkDevice *keyboard = NULL;
|
||||
|
||||
gtk_text_selection_bubble_popup_unset (self);
|
||||
|
||||
priv->text_handles_enabled = FALSE;
|
||||
gtk_text_update_handles (self);
|
||||
|
||||
gtk_widget_queue_draw (widget);
|
||||
|
||||
seat = gdk_display_get_default_seat (gtk_widget_get_display (widget));
|
||||
if (seat)
|
||||
keyboard = gdk_seat_get_keyboard (seat);
|
||||
if (keyboard)
|
||||
g_signal_handlers_disconnect_by_func (keyboard, direction_changed, self);
|
||||
|
||||
if (priv->editable)
|
||||
{
|
||||
gtk_text_schedule_im_reset (self);
|
||||
gtk_im_context_focus_out (priv->im_context);
|
||||
}
|
||||
|
||||
gtk_text_check_cursor_blink (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_focus_changed (GtkEventControllerFocus *controller,
|
||||
GParamSpec *pspec,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkText *self = GTK_TEXT (widget);
|
||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||
GdkSeat *seat = NULL;
|
||||
GdkDevice *keyboard = NULL;
|
||||
|
||||
seat = gdk_display_get_default_seat (gtk_widget_get_display (widget));
|
||||
if (seat)
|
||||
keyboard = gdk_seat_get_keyboard (seat);
|
||||
|
||||
gtk_widget_queue_draw (widget);
|
||||
|
||||
if (gtk_event_controller_focus_is_focus (controller))
|
||||
gtk_text_focus_in (widget);
|
||||
else
|
||||
gtk_text_focus_out (widget);
|
||||
{
|
||||
if (keyboard)
|
||||
g_signal_connect (keyboard, "notify::direction",
|
||||
G_CALLBACK (direction_changed), self);
|
||||
|
||||
if (priv->editable)
|
||||
{
|
||||
gtk_text_schedule_im_reset (self);
|
||||
gtk_im_context_focus_in (priv->im_context);
|
||||
}
|
||||
|
||||
gtk_text_reset_blink_time (self);
|
||||
}
|
||||
else /* Focus out */
|
||||
{
|
||||
gtk_text_selection_bubble_popup_unset (self);
|
||||
|
||||
priv->text_handles_enabled = FALSE;
|
||||
gtk_text_update_handles (self);
|
||||
|
||||
if (keyboard)
|
||||
g_signal_handlers_disconnect_by_func (keyboard, direction_changed, self);
|
||||
|
||||
if (priv->editable)
|
||||
{
|
||||
gtk_text_schedule_im_reset (self);
|
||||
gtk_im_context_focus_out (priv->im_context);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_text_check_cursor_blink (self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -3228,14 +3205,15 @@ gtk_text_grab_focus (GtkWidget *widget)
|
||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||
gboolean select_on_focus;
|
||||
GtkWidget *prev_focus;
|
||||
gboolean prev_focus_was_child;
|
||||
|
||||
prev_focus = gtk_root_get_focus (gtk_widget_get_root (widget));
|
||||
prev_focus_was_child = prev_focus && gtk_widget_is_ancestor (prev_focus, widget);
|
||||
|
||||
if (!GTK_WIDGET_CLASS (gtk_text_parent_class)->grab_focus (GTK_WIDGET (self)))
|
||||
return FALSE;
|
||||
|
||||
if (priv->editable && !priv->in_click &&
|
||||
!(prev_focus && gtk_widget_is_ancestor (prev_focus, widget)))
|
||||
if (priv->editable && !priv->in_click && !prev_focus_was_child)
|
||||
{
|
||||
g_object_get (gtk_widget_get_settings (widget),
|
||||
"gtk-entry-select-on-focus",
|
||||
@ -3256,7 +3234,7 @@ gtk_text_grab_focus (GtkWidget *widget)
|
||||
* Causes @self to have keyboard focus.
|
||||
*
|
||||
* It behaves like gtk_widget_grab_focus(),
|
||||
* except that it doesn't select the contents of the self.
|
||||
* except that it doesn't select the contents of @self.
|
||||
* You only want to call this on some special entries
|
||||
* which the user usually doesn't want to replace all text in,
|
||||
* such as search-as-you-type entries.
|
||||
@ -3317,12 +3295,6 @@ gtk_text_state_flags_changed (GtkWidget *widget,
|
||||
gtk_text_update_cached_style_values (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_root (GtkWidget *widget)
|
||||
{
|
||||
GTK_WIDGET_CLASS (gtk_text_parent_class)->root (widget);
|
||||
}
|
||||
|
||||
/* GtkEditable method implementations
|
||||
*/
|
||||
static void
|
||||
|
@ -4742,15 +4742,9 @@ changed_handler (GtkTextLayout *layout,
|
||||
{
|
||||
gtk_widget_queue_draw (widget);
|
||||
|
||||
DV(g_print(" invalidated rect: %d,%d %d x %d\n",
|
||||
redraw_rect.x,
|
||||
redraw_rect.y,
|
||||
redraw_rect.width,
|
||||
redraw_rect.height));
|
||||
|
||||
queue_update_im_spot_location (text_view);
|
||||
}
|
||||
|
||||
|
||||
if (old_height != new_height)
|
||||
{
|
||||
const GList *iter;
|
||||
@ -7226,8 +7220,10 @@ gtk_text_view_drag_gesture_update (GtkGestureDrag *gesture,
|
||||
data = g_object_get_qdata (G_OBJECT (gesture), quark_text_selection_data);
|
||||
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
||||
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
|
||||
drag_gesture_get_text_surface_coords (gesture, text_view,
|
||||
&start_x, &start_y, &x, &y);
|
||||
|
||||
if (!drag_gesture_get_text_surface_coords (gesture, text_view,
|
||||
&start_x, &start_y, &x, &y))
|
||||
return;
|
||||
|
||||
device = gdk_event_get_device (event);
|
||||
|
||||
@ -7347,8 +7343,11 @@ gtk_text_view_drag_gesture_end (GtkGestureDrag *gesture,
|
||||
|
||||
priv = text_view->priv;
|
||||
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
||||
drag_gesture_get_text_surface_coords (gesture, text_view,
|
||||
&start_x, &start_y, &x, &y);
|
||||
|
||||
if (!drag_gesture_get_text_surface_coords (gesture, text_view,
|
||||
&start_x, &start_y, &x, &y))
|
||||
return;
|
||||
|
||||
|
||||
clicked_in_selection =
|
||||
g_object_get_qdata (G_OBJECT (gesture), quark_text_selection_data) == NULL;
|
||||
|
@ -172,7 +172,7 @@ main (int argc, char **argv)
|
||||
}
|
||||
|
||||
bytes = g_bytes_new_take (contents, len);
|
||||
GTK_NODE_VIEW (nodeview)->node = gsk_render_node_deserialize (bytes, deserialize_error_func, NULL);
|
||||
GTK_NODE_VIEW (nodeview)->node = gsk_render_node_deserialize (bytes, deserialize_error_func, &error);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
if (GTK_NODE_VIEW (nodeview)->node == NULL)
|
||||
|
@ -26,6 +26,7 @@ check_sorted (GtkListBox *list)
|
||||
GtkWidget *row, *label;
|
||||
int res[100];
|
||||
int index, value;
|
||||
int n_rows = 0;
|
||||
int i;
|
||||
|
||||
for (row = gtk_widget_get_first_child (GTK_WIDGET (list));
|
||||
@ -39,10 +40,11 @@ check_sorted (GtkListBox *list)
|
||||
label = gtk_list_box_row_get_child (GTK_LIST_BOX_ROW (row));
|
||||
value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (label), "data"));
|
||||
res[index] = value;
|
||||
n_rows++;
|
||||
}
|
||||
|
||||
for (i = 1; i < 100; i++)
|
||||
g_assert (res[i - 1] <= res[i]);
|
||||
for (i = 1; i < n_rows; i++)
|
||||
g_assert_cmpint (res[i - 1], <=, res[i]);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user