forked from AuroraMiddleware/gtk
Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master See merge request GNOME/gtk!1502
This commit is contained in:
commit
89e5b8cd3a
@ -1354,11 +1354,15 @@ _gdk_device_translate_surface_coord (GdkDevice *device,
|
||||
{
|
||||
axis_info_x = &axis_info;
|
||||
axis_info_y = find_axis_info (device->axes, GDK_AXIS_Y);
|
||||
if (axis_info_y == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
axis_info_x = find_axis_info (device->axes, GDK_AXIS_X);
|
||||
axis_info_y = &axis_info;
|
||||
if (axis_info_x == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
device_width = axis_info_x->max_value - axis_info_x->min_value;
|
||||
|
@ -28,7 +28,7 @@
|
||||
((c) >= 'a' && (c) <= 'f') ? ((c)-'a'+10) : \
|
||||
((c) >= '0' && (c) <= '9') ? ((c)-'0') : \
|
||||
-1))
|
||||
#define _GDK_RGBA_SELECT_COLOR(_str, index3, index6) _GDK_RGBA_DECODE (sizeof(_str) <= 4 ? (_str)[index3] : (_str)[index6])
|
||||
#define _GDK_RGBA_SELECT_COLOR(_str, index3, index6) (sizeof(_str) <= 4 ? _GDK_RGBA_DECODE ((_str)[index3]) : _GDK_RGBA_DECODE ((_str)[index6]))
|
||||
#define GDK_RGBA(str) ((GdkRGBA) {\
|
||||
((_GDK_RGBA_SELECT_COLOR(str, 0, 0) << 4) | _GDK_RGBA_SELECT_COLOR(str, 0, 1)) / 255., \
|
||||
((_GDK_RGBA_SELECT_COLOR(str, 1, 2) << 4) | _GDK_RGBA_SELECT_COLOR(str, 1, 3)) / 255., \
|
||||
|
@ -4118,6 +4118,7 @@ tablet_pad_handle_button (void *data,
|
||||
wp_tablet_pad, button, state));
|
||||
|
||||
group = tablet_pad_lookup_button_group (pad, button);
|
||||
g_assert (group != NULL);
|
||||
n_group = g_list_index (pad->mode_groups, group);
|
||||
|
||||
event = gdk_event_pad_button_new (state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED
|
||||
|
@ -1505,15 +1505,19 @@ update_xft_settings (GdkDisplay *display)
|
||||
TranslationEntry *entry;
|
||||
|
||||
entry = find_translation_entry_by_schema ("org.gnome.settings-daemon.plugins.xsettings", "antialiasing");
|
||||
g_assert (entry);
|
||||
antialiasing = entry->fallback.i;
|
||||
|
||||
entry = find_translation_entry_by_schema ("org.gnome.settings-daemon.plugins.xsettings", "hinting");
|
||||
g_assert (entry);
|
||||
hinting = entry->fallback.i;
|
||||
|
||||
entry = find_translation_entry_by_schema ("org.gnome.settings-daemon.plugins.xsettings", "rgba-order");
|
||||
g_assert (entry);
|
||||
order = entry->fallback.i;
|
||||
|
||||
entry = find_translation_entry_by_schema ("org.gnome.desktop.interface", "text-scaling-factor");
|
||||
g_assert (entry);
|
||||
dpi = 96.0 * entry->fallback.i / 65536.0 * 1024; /* Xft wants 1/1024th of an inch */
|
||||
}
|
||||
else
|
||||
|
@ -2673,7 +2673,11 @@ gdk_x11_display_error_trap_pop_internal (GdkDisplay *display,
|
||||
break;
|
||||
}
|
||||
|
||||
g_return_val_if_fail (trap != NULL, Success);
|
||||
if (trap == NULL)
|
||||
{
|
||||
g_critical ("gdk_x11_display_error_trap_pop() called without gdk_x11_display_error_trap_push()");
|
||||
return Success;
|
||||
}
|
||||
g_assert (trap->end_sequence == 0);
|
||||
|
||||
/* May need to sync to fill in trap->error_code if we care about
|
||||
|
@ -129,7 +129,7 @@ _gdk_x11_surface_get_toplevel (GdkSurface *surface)
|
||||
{
|
||||
GdkX11Surface *impl;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
||||
g_assert (GDK_IS_SURFACE (surface));
|
||||
|
||||
impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
|
@ -658,7 +658,7 @@ gsk_gl_driver_mark_texture_permanent (GskGLDriver *self,
|
||||
{
|
||||
Texture *t = gsk_gl_driver_get_texture (self, texture_id);
|
||||
|
||||
g_assert_nonnull (t);
|
||||
g_assert (t != NULL);
|
||||
|
||||
t->permanent = TRUE;
|
||||
}
|
||||
|
@ -332,6 +332,7 @@ internal_change_entry (const gchar *accel_path,
|
||||
{
|
||||
gtk_accel_map_add_entry (accel_path, 0, 0);
|
||||
entry = accel_path_lookup (accel_path);
|
||||
g_assert (entry);
|
||||
entry->accel_key = accel_key;
|
||||
entry->accel_mods = accel_mods;
|
||||
entry->changed = TRUE;
|
||||
|
@ -382,8 +382,7 @@ state_pop (ParserData *data)
|
||||
{
|
||||
gpointer old = NULL;
|
||||
|
||||
if (!data->stack)
|
||||
return NULL;
|
||||
g_assert (data->stack);
|
||||
|
||||
old = data->stack->data;
|
||||
data->stack = g_slist_delete_link (data->stack, data->stack);
|
||||
|
@ -2123,8 +2123,7 @@ real_choose_icon (GtkIconTheme *self,
|
||||
gint size,
|
||||
gint scale,
|
||||
GtkIconLookupFlags flags,
|
||||
gboolean non_blocking,
|
||||
gboolean *would_block)
|
||||
gboolean non_blocking)
|
||||
{
|
||||
GList *l;
|
||||
GtkIconPaintable *icon = NULL;
|
||||
@ -2135,10 +2134,7 @@ real_choose_icon (GtkIconTheme *self,
|
||||
IconKey key;
|
||||
|
||||
if (!ensure_valid_themes (self, non_blocking))
|
||||
{
|
||||
*would_block = TRUE;
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
key.icon_names = (gchar **)icon_names;
|
||||
key.size = size;
|
||||
@ -2209,11 +2205,12 @@ real_choose_icon (GtkIconTheme *self,
|
||||
g_clear_object (&icon);
|
||||
}
|
||||
|
||||
icon->is_svg = suffix_from_name (icon->filename) == ICON_CACHE_FLAG_SVG_SUFFIX;
|
||||
icon->is_resource = unthemed_icon->is_resource;
|
||||
|
||||
if (icon)
|
||||
goto out;
|
||||
{
|
||||
icon->is_svg = suffix_from_name (icon->filename) == ICON_CACHE_FLAG_SVG_SUFFIX;
|
||||
icon->is_resource = unthemed_icon->is_resource;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2281,8 +2278,7 @@ choose_icon (GtkIconTheme *self,
|
||||
gint scale,
|
||||
GtkTextDirection direction,
|
||||
GtkIconLookupFlags flags,
|
||||
gboolean non_blocking,
|
||||
gboolean *would_block)
|
||||
gboolean non_blocking)
|
||||
{
|
||||
gboolean has_regular = FALSE, has_symbolic = FALSE;
|
||||
GtkIconPaintable *icon;
|
||||
@ -2337,7 +2333,7 @@ choose_icon (GtkIconTheme *self,
|
||||
size,
|
||||
scale,
|
||||
flags & ~(GTK_ICON_LOOKUP_FORCE_REGULAR | GTK_ICON_LOOKUP_FORCE_SYMBOLIC),
|
||||
non_blocking, would_block);
|
||||
non_blocking);
|
||||
|
||||
g_ptr_array_free (new_names, TRUE);
|
||||
}
|
||||
@ -2363,7 +2359,7 @@ choose_icon (GtkIconTheme *self,
|
||||
size,
|
||||
scale,
|
||||
flags & ~(GTK_ICON_LOOKUP_FORCE_REGULAR | GTK_ICON_LOOKUP_FORCE_SYMBOLIC),
|
||||
non_blocking, would_block);
|
||||
non_blocking);
|
||||
|
||||
g_ptr_array_free (new_names, TRUE);
|
||||
}
|
||||
@ -2381,7 +2377,7 @@ choose_icon (GtkIconTheme *self,
|
||||
size,
|
||||
scale,
|
||||
flags & ~(GTK_ICON_LOOKUP_FORCE_REGULAR | GTK_ICON_LOOKUP_FORCE_SYMBOLIC),
|
||||
non_blocking, would_block);
|
||||
non_blocking);
|
||||
|
||||
g_ptr_array_free (new_names, TRUE);
|
||||
}
|
||||
@ -2392,7 +2388,7 @@ choose_icon (GtkIconTheme *self,
|
||||
size,
|
||||
scale,
|
||||
flags & ~(GTK_ICON_LOOKUP_FORCE_REGULAR | GTK_ICON_LOOKUP_FORCE_SYMBOLIC),
|
||||
non_blocking, would_block);
|
||||
non_blocking);
|
||||
}
|
||||
|
||||
return icon;
|
||||
@ -2469,7 +2465,7 @@ gtk_icon_theme_lookup_icon (GtkIconTheme *self,
|
||||
memcpy (&names[1], fallbacks, sizeof (char *) * n_fallbacks);
|
||||
names[n_fallbacks + 1] = NULL;
|
||||
|
||||
icon = choose_icon (self, names, size, scale, direction, flags, FALSE, NULL);
|
||||
icon = choose_icon (self, names, size, scale, direction, flags, FALSE);
|
||||
|
||||
g_free (names);
|
||||
}
|
||||
@ -2480,7 +2476,7 @@ gtk_icon_theme_lookup_icon (GtkIconTheme *self,
|
||||
names[0] = icon_name;
|
||||
names[1] = NULL;
|
||||
|
||||
icon = choose_icon (self, names, size, scale, direction, flags, FALSE, NULL);
|
||||
icon = choose_icon (self, names, size, scale, direction, flags, FALSE);
|
||||
}
|
||||
|
||||
gtk_icon_theme_unlock (self);
|
||||
@ -4086,6 +4082,7 @@ gtk_icon_theme_lookup_by_gicon (GtkIconTheme *self,
|
||||
/* We can't render emblemed icons atm, but at least render the base */
|
||||
while (G_IS_EMBLEMED_ICON (gicon))
|
||||
gicon = g_emblemed_icon_get_icon (G_EMBLEMED_ICON (gicon));
|
||||
g_assert (gicon); /* shut up gcc -Wnull-dereference */
|
||||
|
||||
if (GDK_IS_PIXBUF (gicon))
|
||||
{
|
||||
|
@ -321,7 +321,7 @@ notify_surrounding_text (GtkIMContextWayland *context)
|
||||
}
|
||||
|
||||
mid = MIN (context->surrounding.cursor_idx,
|
||||
context->surrounding.cursor_idx) + (cursor_len / 2);
|
||||
context->surrounding.anchor_idx) + (cursor_len / 2);
|
||||
a = MAX (0, mid - (MAX_LEN / 2));
|
||||
b = MIN (MAX_LEN, mid + (MAX_LEN / 2));
|
||||
|
||||
|
@ -234,6 +234,7 @@ gtk_menu_tracker_item_visibility_changed (GtkMenuTrackerItem *item,
|
||||
|
||||
/* remember: the item is our model */
|
||||
section = gtk_menu_tracker_section_find_model (tracker->toplevel, item, &offset);
|
||||
g_assert (section);
|
||||
|
||||
was_visible = section->items != NULL;
|
||||
|
||||
@ -424,6 +425,7 @@ gtk_menu_tracker_model_changed (GMenuModel *model,
|
||||
* position of that section within the overall menu.
|
||||
*/
|
||||
section = gtk_menu_tracker_section_find_model (tracker->toplevel, model, &offset);
|
||||
g_assert (section);
|
||||
|
||||
/* Next, seek through that section to the change point. This gives us
|
||||
* the correct GSList** to make the change to and also finds the final
|
||||
|
@ -882,7 +882,7 @@ get_name_for_window_with_pid (GtkMountOperationLookupContext *context,
|
||||
|
||||
endp = NULL;
|
||||
windowid_window = (Window) g_ascii_strtoll (windowid_value, &endp, 10);
|
||||
if (endp != NULL || *endp == '\0')
|
||||
if (endp != NULL && *endp == '\0')
|
||||
{
|
||||
window = windowid_window;
|
||||
}
|
||||
|
@ -3359,7 +3359,7 @@ gtk_notebook_drag_drop (GtkDropTarget *dest,
|
||||
|
||||
source = drag ? g_object_get_data (G_OBJECT (drag), "gtk-notebook-drag-origin") : NULL;
|
||||
|
||||
if (!gtk_notebook_can_drag_from (self, source, source->priv->cur_page))
|
||||
if (!source || !gtk_notebook_can_drag_from (self, source, source->priv->cur_page))
|
||||
return FALSE;
|
||||
|
||||
self->priv->mouse_x = x;
|
||||
|
@ -690,6 +690,7 @@ gtk_path_bar_scroll_down (GtkPathBar *path_bar)
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_assert (down_button);
|
||||
|
||||
gtk_widget_get_allocation (GTK_WIDGET (path_bar), &allocation);
|
||||
gtk_widget_get_allocation (BUTTON_DATA (down_button->data)->button, &button_allocation);
|
||||
|
@ -61,8 +61,8 @@ struct _GtkRbNode
|
||||
};
|
||||
};
|
||||
|
||||
#define NODE_FROM_POINTER(ptr) ((GtkRbNode *) ((ptr) ? (((guchar *) (ptr)) - sizeof (GtkRbNode)) : NULL))
|
||||
#define NODE_TO_POINTER(node) ((gpointer) ((node) ? (((guchar *) (node)) + sizeof (GtkRbNode)) : NULL))
|
||||
#define NODE_FROM_POINTER(ptr) ((GtkRbNode *) (((guchar *) (ptr)) - sizeof (GtkRbNode)))
|
||||
#define NODE_TO_POINTER(node) ((node) ? ((gpointer) (((guchar *) (node)) + sizeof (GtkRbNode))) : NULL)
|
||||
#define NODE_TO_AUG_POINTER(tree, node) ((gpointer) ((node) ? (((guchar *) (node)) + sizeof (GtkRbNode) + (tree)->element_size) : NULL))
|
||||
|
||||
static inline gboolean
|
||||
@ -381,10 +381,9 @@ gtk_rb_tree_insert_fixup (GtkRbTree *tree,
|
||||
if (node == p->right)
|
||||
{
|
||||
/* make node a left child */
|
||||
node = p;
|
||||
gtk_rb_node_rotate_left (tree, node);
|
||||
p = parent (node);
|
||||
pp = parent (p);
|
||||
gtk_rb_node_rotate_left (tree, p);
|
||||
p = node;
|
||||
node = p->left;
|
||||
}
|
||||
/* recolor and rotate */
|
||||
set_black (p);
|
||||
@ -410,10 +409,9 @@ gtk_rb_tree_insert_fixup (GtkRbTree *tree,
|
||||
/* uncle is black */
|
||||
if (node == p->left)
|
||||
{
|
||||
node = p;
|
||||
gtk_rb_node_rotate_right (tree, node);
|
||||
p = parent (node);
|
||||
pp = parent (p);
|
||||
gtk_rb_node_rotate_right (tree, p);
|
||||
p = node;
|
||||
node = p->right;
|
||||
}
|
||||
set_black (p);
|
||||
set_red (pp);
|
||||
@ -443,6 +441,7 @@ gtk_rb_tree_remove_node_fixup (GtkRbTree *tree,
|
||||
gtk_rb_node_rotate_left (tree, p);
|
||||
w = p->right;
|
||||
}
|
||||
g_assert (w);
|
||||
if (is_black (w->left) && is_black (w->right))
|
||||
{
|
||||
set_red (w);
|
||||
@ -474,6 +473,7 @@ gtk_rb_tree_remove_node_fixup (GtkRbTree *tree,
|
||||
gtk_rb_node_rotate_right (tree, p);
|
||||
w = p->left;
|
||||
}
|
||||
g_assert (w);
|
||||
if (is_black (w->right) && is_black (w->left))
|
||||
{
|
||||
set_red (w);
|
||||
|
@ -693,6 +693,7 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self)
|
||||
n += height;
|
||||
}
|
||||
|
||||
g_assert (g);
|
||||
for (g = g->next; g; g = g->next)
|
||||
{
|
||||
GtkShortcutsGroup *group = g->data;
|
||||
|
@ -2849,8 +2849,9 @@ _gtk_text_btree_set_mark (GtkTextBTree *tree,
|
||||
seg = real_set_mark (tree, existing_mark,
|
||||
name, left_gravity, iter, should_exist,
|
||||
TRUE);
|
||||
g_assert (seg);
|
||||
|
||||
return seg ? seg->body.mark.obj : NULL;
|
||||
return seg->body.mark.obj;
|
||||
}
|
||||
|
||||
gboolean
|
||||
@ -3126,7 +3127,7 @@ _gtk_text_btree_last_could_contain_tag (GtkTextBTree *tree,
|
||||
{
|
||||
info = gtk_text_btree_get_existing_tag_info (tree, tag);
|
||||
|
||||
if (info->tag_root == NULL)
|
||||
if (info == NULL || info->tag_root == NULL)
|
||||
return NULL;
|
||||
|
||||
node = info->tag_root;
|
||||
@ -3135,7 +3136,6 @@ _gtk_text_btree_last_could_contain_tag (GtkTextBTree *tree,
|
||||
|
||||
while (node->level > 0)
|
||||
{
|
||||
g_assert (node != NULL); /* Failure probably means bad tag summaries. */
|
||||
last_node = NULL;
|
||||
node = node->children.node;
|
||||
while (node != NULL)
|
||||
@ -3146,6 +3146,7 @@ _gtk_text_btree_last_could_contain_tag (GtkTextBTree *tree,
|
||||
}
|
||||
|
||||
node = last_node;
|
||||
g_assert (node != NULL); /* Failure probably means bad tag summaries. */
|
||||
}
|
||||
|
||||
g_assert (node != NULL); /* The tag summaries said some node had
|
||||
@ -3450,6 +3451,7 @@ ensure_end_iter_segment (GtkTextBTree *tree)
|
||||
last_with_chars = seg;
|
||||
seg = seg->next;
|
||||
}
|
||||
g_assert (last_with_chars);
|
||||
|
||||
tree->end_iter_segment = last_with_chars;
|
||||
|
||||
@ -4455,10 +4457,6 @@ _gtk_text_line_next_could_contain_tag (GtkTextLine *line,
|
||||
|
||||
while (node->level > 0)
|
||||
{
|
||||
g_assert (node != NULL); /* If this fails, it likely means an
|
||||
incorrect tag summary led us on a
|
||||
wild goose chase down this branch of
|
||||
the tree. */
|
||||
node = node->children.node;
|
||||
while (node != NULL)
|
||||
{
|
||||
@ -4466,6 +4464,10 @@ _gtk_text_line_next_could_contain_tag (GtkTextLine *line,
|
||||
break;
|
||||
node = node->next;
|
||||
}
|
||||
g_assert (node != NULL); /* If this fails, it likely means an
|
||||
incorrect tag summary led us on a
|
||||
wild goose chase down this branch of
|
||||
the tree. */
|
||||
}
|
||||
|
||||
g_assert (node != NULL);
|
||||
|
@ -209,6 +209,8 @@ gtk_text_iter_make_real (const GtkTextIter *_iter)
|
||||
GtkTextRealIter *iter;
|
||||
|
||||
iter = gtk_text_iter_make_surreal (_iter);
|
||||
if (iter == NULL)
|
||||
return NULL;
|
||||
|
||||
if (iter->segments_changed_stamp !=
|
||||
_gtk_text_btree_get_segments_changed_stamp (iter->tree))
|
||||
@ -242,8 +244,8 @@ iter_init_common (GtkTextIter *_iter,
|
||||
{
|
||||
GtkTextRealIter *iter = (GtkTextRealIter*)_iter;
|
||||
|
||||
g_return_val_if_fail (iter != NULL, NULL);
|
||||
g_return_val_if_fail (tree != NULL, NULL);
|
||||
g_assert (iter != NULL);
|
||||
g_assert (tree != NULL);
|
||||
|
||||
memset (iter, 0, sizeof (GtkTextRealIter));
|
||||
|
||||
|
@ -5692,8 +5692,8 @@ gtk_text_view_remove (GtkContainer *container,
|
||||
|
||||
if (vc == priv->left_child)
|
||||
vcp = &priv->left_child;
|
||||
else if (vc == priv->left_child)
|
||||
vcp = &priv->left_child;
|
||||
else if (vc == priv->right_child)
|
||||
vcp = &priv->right_child;
|
||||
else if (vc == priv->top_child)
|
||||
vcp = &priv->top_child;
|
||||
else if (vc == priv->bottom_child)
|
||||
|
@ -3002,6 +3002,7 @@ gtk_tree_model_filter_get_iter_full (GtkTreeModel *model,
|
||||
}
|
||||
|
||||
elt = GET_ELT (siter);
|
||||
g_assert (elt);
|
||||
|
||||
if (!elt->children)
|
||||
gtk_tree_model_filter_build_level (filter, level, elt, FALSE);
|
||||
@ -3072,6 +3073,7 @@ gtk_tree_model_filter_get_iter (GtkTreeModel *model,
|
||||
}
|
||||
|
||||
elt = GET_ELT (siter);
|
||||
g_assert (elt);
|
||||
if (!elt->children)
|
||||
gtk_tree_model_filter_build_level (filter, level, elt, FALSE);
|
||||
level = elt->children;
|
||||
@ -4192,6 +4194,7 @@ gtk_tree_model_filter_convert_path_to_child_path (GtkTreeModelFilter *filter,
|
||||
}
|
||||
|
||||
elt = GET_ELT (siter);
|
||||
g_assert (elt);
|
||||
if (elt->children == NULL)
|
||||
gtk_tree_model_filter_build_level (filter, level, elt, FALSE);
|
||||
|
||||
|
@ -1285,6 +1285,7 @@ gtk_tree_model_sort_get_iter (GtkTreeModel *tree_model,
|
||||
}
|
||||
|
||||
elt = GET_ELT (siter);
|
||||
g_assert (elt);
|
||||
if (elt->children == NULL)
|
||||
gtk_tree_model_sort_build_level (tree_model_sort, level, elt);
|
||||
|
||||
@ -2395,6 +2396,7 @@ gtk_tree_model_sort_convert_path_to_child_path (GtkTreeModelSort *tree_model_sor
|
||||
}
|
||||
|
||||
elt = GET_ELT (siter);
|
||||
g_assert (elt);
|
||||
if (elt->children == NULL)
|
||||
gtk_tree_model_sort_build_level (tree_model_sort, level, elt);
|
||||
|
||||
|
@ -269,6 +269,7 @@ gtk_tree_rbtree_remove_node_fixup (GtkTreeRBTree *tree,
|
||||
gtk_tree_rbnode_rotate_left (tree, parent);
|
||||
w = parent->right;
|
||||
}
|
||||
g_assert (w);
|
||||
if (GTK_TREE_RBNODE_GET_COLOR (w->left) == GTK_TREE_RBNODE_BLACK && GTK_TREE_RBNODE_GET_COLOR (w->right) == GTK_TREE_RBNODE_BLACK)
|
||||
{
|
||||
GTK_TREE_RBNODE_SET_COLOR (w, GTK_TREE_RBNODE_RED);
|
||||
@ -300,6 +301,7 @@ gtk_tree_rbtree_remove_node_fixup (GtkTreeRBTree *tree,
|
||||
gtk_tree_rbnode_rotate_right (tree, parent);
|
||||
w = parent->left;
|
||||
}
|
||||
g_assert (w);
|
||||
if (GTK_TREE_RBNODE_GET_COLOR (w->right) == GTK_TREE_RBNODE_BLACK && GTK_TREE_RBNODE_GET_COLOR (w->left) == GTK_TREE_RBNODE_BLACK)
|
||||
{
|
||||
GTK_TREE_RBNODE_SET_COLOR (w, GTK_TREE_RBNODE_RED);
|
||||
@ -722,9 +724,9 @@ gtk_tree_rbtree_column_invalid (GtkTreeRBTree *tree)
|
||||
if (tree == NULL)
|
||||
return;
|
||||
|
||||
node = gtk_tree_rbtree_first (tree);
|
||||
|
||||
do
|
||||
for (node = gtk_tree_rbtree_first (tree);
|
||||
node != NULL;
|
||||
node = gtk_tree_rbtree_next (tree, node))
|
||||
{
|
||||
if (!(GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_INVALID)))
|
||||
GTK_TREE_RBNODE_SET_FLAG (node, GTK_TREE_RBNODE_COLUMN_INVALID);
|
||||
@ -733,7 +735,6 @@ gtk_tree_rbtree_column_invalid (GtkTreeRBTree *tree)
|
||||
if (node->children)
|
||||
gtk_tree_rbtree_column_invalid (node->children);
|
||||
}
|
||||
while ((node = gtk_tree_rbtree_next (tree, node)) != NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -744,9 +745,9 @@ gtk_tree_rbtree_mark_invalid (GtkTreeRBTree *tree)
|
||||
if (tree == NULL)
|
||||
return;
|
||||
|
||||
node = gtk_tree_rbtree_first (tree);
|
||||
|
||||
do
|
||||
for (node = gtk_tree_rbtree_first (tree);
|
||||
node != NULL;
|
||||
node = gtk_tree_rbtree_next (tree, node))
|
||||
{
|
||||
GTK_TREE_RBNODE_SET_FLAG (node, GTK_TREE_RBNODE_INVALID);
|
||||
GTK_TREE_RBNODE_SET_FLAG (node, GTK_TREE_RBNODE_DESCENDANTS_INVALID);
|
||||
@ -754,7 +755,6 @@ gtk_tree_rbtree_mark_invalid (GtkTreeRBTree *tree)
|
||||
if (node->children)
|
||||
gtk_tree_rbtree_mark_invalid (node->children);
|
||||
}
|
||||
while ((node = gtk_tree_rbtree_next (tree, node)) != NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -767,9 +767,9 @@ gtk_tree_rbtree_set_fixed_height (GtkTreeRBTree *tree,
|
||||
if (tree == NULL)
|
||||
return;
|
||||
|
||||
node = gtk_tree_rbtree_first (tree);
|
||||
|
||||
do
|
||||
for (node = gtk_tree_rbtree_first (tree);
|
||||
node != NULL;
|
||||
node = gtk_tree_rbtree_next (tree, node))
|
||||
{
|
||||
if (GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_INVALID))
|
||||
{
|
||||
@ -781,7 +781,6 @@ gtk_tree_rbtree_set_fixed_height (GtkTreeRBTree *tree,
|
||||
if (node->children)
|
||||
gtk_tree_rbtree_set_fixed_height (node->children, height, mark_valid);
|
||||
}
|
||||
while ((node = gtk_tree_rbtree_next (tree, node)) != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1598,6 +1597,8 @@ gtk_tree_rbtree_test_dirty (GtkTreeRBTree *tree,
|
||||
GtkTreeRBNode *node,
|
||||
gint expected_dirtyness)
|
||||
{
|
||||
g_assert (node);
|
||||
|
||||
if (expected_dirtyness)
|
||||
{
|
||||
g_assert (GTK_TREE_RBNODE_FLAG_SET (node, GTK_TREE_RBNODE_COLUMN_INVALID) ||
|
||||
|
@ -238,16 +238,20 @@ elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
|
||||
test_cflags = [
|
||||
'-fno-strict-aliasing',
|
||||
'-Wcast-align',
|
||||
'-Wduplicated-branches',
|
||||
'-Wduplicated-cond',
|
||||
'-Wformat=2',
|
||||
'-Wformat-nonliteral',
|
||||
'-Wformat-security',
|
||||
'-Wignored-qualifiers',
|
||||
'-Wimplicit-function-declaration',
|
||||
'-Wlogical-op',
|
||||
'-Wmisleading-indentation',
|
||||
'-Wmissing-format-attribute',
|
||||
'-Wmissing-include-dirs',
|
||||
'-Wmissing-noreturn',
|
||||
'-Wnested-externs',
|
||||
'-Wnull-dereference',
|
||||
'-Wold-style-definition',
|
||||
'-Wpointer-arith',
|
||||
'-Wshadow',
|
||||
|
@ -50,6 +50,7 @@ gtk_tests = [
|
||||
['testgtk'],
|
||||
['testheaderbar'],
|
||||
['testheightforwidth'],
|
||||
['testhover'],
|
||||
['testiconview'],
|
||||
['testiconview-keynav'],
|
||||
['testicontheme'],
|
||||
|
291
tests/testhover.c
Normal file
291
tests/testhover.c
Normal file
@ -0,0 +1,291 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#if 0
|
||||
#define gtk_event_controller_motion_new gtk_drop_controller_motion_new
|
||||
#define gtk_event_controller_motion_contains_pointer gtk_drop_controller_motion_contains_pointer
|
||||
#define gtk_event_controller_motion_is_pointer gtk_drop_controller_motion_is_pointer
|
||||
#undef GTK_EVENT_CONTROLLER_MOTION
|
||||
#define GTK_EVENT_CONTROLLER_MOTION GTK_DROP_CONTROLLER_MOTION
|
||||
#endif
|
||||
|
||||
static void
|
||||
quit_cb (GtkWidget *widget,
|
||||
gpointer unused)
|
||||
{
|
||||
g_main_context_wakeup (NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
enter_annoy_cb (GtkEventController *controller,
|
||||
double x,
|
||||
double y)
|
||||
{
|
||||
GtkWidget *widget = gtk_event_controller_get_widget (controller);
|
||||
GtkWindow *window = GTK_WINDOW (gtk_widget_get_root (widget));
|
||||
|
||||
g_print ("%15s ENTER %s %g, %g\n",
|
||||
gtk_window_get_title (window),
|
||||
gtk_event_controller_motion_contains_pointer (GTK_EVENT_CONTROLLER_MOTION (controller))
|
||||
? gtk_event_controller_motion_is_pointer (GTK_EVENT_CONTROLLER_MOTION (controller))
|
||||
? "IS "
|
||||
: "CONTAIN"
|
||||
: " ",
|
||||
x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
motion_annoy_cb (GtkEventController *controller,
|
||||
double x,
|
||||
double y)
|
||||
{
|
||||
GtkWidget *widget = gtk_event_controller_get_widget (controller);
|
||||
GtkWindow *window = GTK_WINDOW (gtk_widget_get_root (widget));
|
||||
|
||||
g_print ("%15s MOVE %s %g, %g\n",
|
||||
gtk_window_get_title (window),
|
||||
gtk_event_controller_motion_contains_pointer (GTK_EVENT_CONTROLLER_MOTION (controller))
|
||||
? gtk_event_controller_motion_is_pointer (GTK_EVENT_CONTROLLER_MOTION (controller))
|
||||
? "IS "
|
||||
: "CONTAIN"
|
||||
: " ",
|
||||
x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
leave_annoy_cb (GtkEventController *controller)
|
||||
{
|
||||
GtkWidget *widget = gtk_event_controller_get_widget (controller);
|
||||
GtkWindow *window = GTK_WINDOW (gtk_widget_get_root (widget));
|
||||
|
||||
g_print ("%15s LEAVE %s\n",
|
||||
gtk_window_get_title (window),
|
||||
gtk_event_controller_motion_contains_pointer (GTK_EVENT_CONTROLLER_MOTION (controller))
|
||||
? gtk_event_controller_motion_is_pointer (GTK_EVENT_CONTROLLER_MOTION (controller))
|
||||
? "IS "
|
||||
: "CONTAIN"
|
||||
: " ");
|
||||
}
|
||||
|
||||
static GtkEventController *
|
||||
annoying_event_controller_motion_new (void)
|
||||
{
|
||||
GtkEventController *controller = gtk_event_controller_motion_new ();
|
||||
|
||||
g_signal_connect (controller, "enter", G_CALLBACK (enter_annoy_cb), NULL);
|
||||
g_signal_connect (controller, "motion", G_CALLBACK (motion_annoy_cb), NULL);
|
||||
g_signal_connect (controller, "leave", G_CALLBACK (leave_annoy_cb), NULL);
|
||||
|
||||
return controller;
|
||||
}
|
||||
|
||||
/*** TEST 1: remove()/add() ***/
|
||||
|
||||
static void
|
||||
enter1_cb (GtkEventController *controller)
|
||||
{
|
||||
GtkWidget *box = gtk_event_controller_get_widget (controller);
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (box), gtk_widget_get_first_child (box));
|
||||
gtk_container_add (GTK_CONTAINER (box), gtk_label_new ("HOVER!"));
|
||||
}
|
||||
|
||||
static void
|
||||
leave1_cb (GtkEventController *controller)
|
||||
{
|
||||
GtkWidget *box = gtk_event_controller_get_widget (controller);
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (box), gtk_widget_get_first_child (box));
|
||||
gtk_container_add (GTK_CONTAINER (box), gtk_image_new_from_icon_name ("start-here"));
|
||||
}
|
||||
|
||||
static void
|
||||
test1 (void)
|
||||
{
|
||||
GtkWidget *win;
|
||||
GtkWidget *box;
|
||||
GtkEventController *controller;
|
||||
win = gtk_window_new ();
|
||||
gtk_window_set_default_size (GTK_WINDOW (win), 400, 300);
|
||||
gtk_window_set_title (GTK_WINDOW (win), "add/remove");
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (win), box);
|
||||
controller = annoying_event_controller_motion_new ();
|
||||
g_signal_connect (controller, "enter", G_CALLBACK (enter1_cb), NULL);
|
||||
g_signal_connect (controller, "leave", G_CALLBACK (leave1_cb), NULL);
|
||||
gtk_widget_add_controller (box, controller);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (box), gtk_image_new_from_icon_name ("start-here"));
|
||||
|
||||
gtk_widget_show (win);
|
||||
|
||||
g_signal_connect (win, "destroy", G_CALLBACK (quit_cb), NULL);
|
||||
}
|
||||
|
||||
/*** TEST 2: hide()/show() ***/
|
||||
|
||||
static void
|
||||
enter2_cb (GtkEventController *controller)
|
||||
{
|
||||
GtkWidget *box = gtk_event_controller_get_widget (controller);
|
||||
|
||||
gtk_widget_hide (gtk_widget_get_first_child (box));
|
||||
gtk_widget_show (gtk_widget_get_last_child (box));
|
||||
}
|
||||
|
||||
static void
|
||||
leave2_cb (GtkEventController *controller)
|
||||
{
|
||||
GtkWidget *box = gtk_event_controller_get_widget (controller);
|
||||
|
||||
gtk_widget_show (gtk_widget_get_first_child (box));
|
||||
gtk_widget_hide (gtk_widget_get_last_child (box));
|
||||
}
|
||||
|
||||
static void
|
||||
test2 (void)
|
||||
{
|
||||
GtkWidget *win;
|
||||
GtkWidget *box;
|
||||
GtkEventController *controller;
|
||||
win = gtk_window_new ();
|
||||
gtk_window_set_default_size (GTK_WINDOW (win), 400, 300);
|
||||
gtk_window_set_title (GTK_WINDOW (win), "show/hide");
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (win), box);
|
||||
controller = annoying_event_controller_motion_new ();
|
||||
g_signal_connect (controller, "enter", G_CALLBACK (enter2_cb), NULL);
|
||||
g_signal_connect (controller, "leave", G_CALLBACK (leave2_cb), NULL);
|
||||
gtk_widget_add_controller (box, controller);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (box), gtk_image_new_from_icon_name ("start-here"));
|
||||
gtk_container_add (GTK_CONTAINER (box), gtk_label_new ("HOVER!"));
|
||||
gtk_widget_hide (gtk_widget_get_last_child (box));
|
||||
|
||||
gtk_widget_show (win);
|
||||
|
||||
g_signal_connect (win, "destroy", G_CALLBACK (quit_cb), NULL);
|
||||
}
|
||||
|
||||
/*** TEST 3: set_child_visible() ***/
|
||||
|
||||
static void
|
||||
enter3_cb (GtkEventController *controller)
|
||||
{
|
||||
GtkWidget *stack = gtk_event_controller_get_widget (controller);
|
||||
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (stack), "enter");
|
||||
}
|
||||
|
||||
static void
|
||||
leave3_cb (GtkEventController *controller)
|
||||
{
|
||||
GtkWidget *stack = gtk_event_controller_get_widget (controller);
|
||||
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (stack), "leave");
|
||||
}
|
||||
|
||||
static void
|
||||
test3 (void)
|
||||
{
|
||||
GtkWidget *win;
|
||||
GtkWidget *stack;
|
||||
GtkEventController *controller;
|
||||
win = gtk_window_new ();
|
||||
gtk_window_set_default_size (GTK_WINDOW (win), 400, 300);
|
||||
gtk_window_set_title (GTK_WINDOW (win), "child-visible");
|
||||
|
||||
stack = gtk_stack_new ();
|
||||
gtk_container_add (GTK_CONTAINER (win), stack);
|
||||
controller = annoying_event_controller_motion_new ();
|
||||
g_signal_connect (controller, "enter", G_CALLBACK (enter3_cb), NULL);
|
||||
g_signal_connect (controller, "leave", G_CALLBACK (leave3_cb), NULL);
|
||||
gtk_widget_add_controller (stack, controller);
|
||||
|
||||
gtk_stack_add_named (GTK_STACK (stack), gtk_image_new_from_icon_name ("start-here"), "leave");
|
||||
gtk_stack_add_named (GTK_STACK (stack), gtk_label_new ("HOVER!"), "enter");
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (stack), "leave");
|
||||
|
||||
gtk_widget_show (win);
|
||||
|
||||
g_signal_connect (win, "destroy", G_CALLBACK (quit_cb), NULL);
|
||||
}
|
||||
|
||||
/*** TEST 4: move ***/
|
||||
|
||||
static void
|
||||
enter4_cb (GtkEventController *controller)
|
||||
{
|
||||
GtkWidget *fixed = gtk_event_controller_get_widget (controller);
|
||||
|
||||
gtk_fixed_move (GTK_FIXED (fixed), gtk_widget_get_first_child (fixed), -1000, -1000);
|
||||
gtk_fixed_move (GTK_FIXED (fixed), gtk_widget_get_last_child (fixed), 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
leave4_cb (GtkEventController *controller)
|
||||
{
|
||||
GtkWidget *fixed = gtk_event_controller_get_widget (controller);
|
||||
|
||||
gtk_fixed_move (GTK_FIXED (fixed), gtk_widget_get_first_child (fixed), 0, 0);
|
||||
gtk_fixed_move (GTK_FIXED (fixed), gtk_widget_get_last_child (fixed), -1000, -1000);
|
||||
}
|
||||
|
||||
static void
|
||||
test4 (void)
|
||||
{
|
||||
GtkWidget *win;
|
||||
GtkWidget *fixed;
|
||||
GtkEventController *controller;
|
||||
win = gtk_window_new ();
|
||||
gtk_window_set_default_size (GTK_WINDOW (win), 400, 300);
|
||||
gtk_window_set_title (GTK_WINDOW (win), "move");
|
||||
|
||||
fixed = gtk_fixed_new ();
|
||||
gtk_container_add (GTK_CONTAINER (win), fixed);
|
||||
controller = annoying_event_controller_motion_new ();
|
||||
g_signal_connect (controller, "enter", G_CALLBACK (enter4_cb), NULL);
|
||||
g_signal_connect (controller, "leave", G_CALLBACK (leave4_cb), NULL);
|
||||
gtk_widget_add_controller (fixed, controller);
|
||||
|
||||
gtk_fixed_put (GTK_FIXED (fixed), gtk_image_new_from_icon_name ("start-here"), 0, 0);
|
||||
gtk_fixed_put (GTK_FIXED (fixed), gtk_label_new ("HOVER!"), -1000, -1000);
|
||||
|
||||
gtk_widget_show (win);
|
||||
|
||||
g_signal_connect (win, "destroy", G_CALLBACK (quit_cb), NULL);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkCssProvider *provider;
|
||||
|
||||
gtk_init ();
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider,
|
||||
":hover {"
|
||||
" box-shadow: inset 0px 0px 0px 1px red;"
|
||||
" }"
|
||||
" window :not(.title):hover {"
|
||||
" background: yellow;"
|
||||
" }"
|
||||
" window :not(.title):hover * {"
|
||||
" background: goldenrod;"
|
||||
" }",
|
||||
-1);
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (), GTK_STYLE_PROVIDER (provider), 800);
|
||||
g_object_unref (provider);
|
||||
|
||||
test1();
|
||||
test2();
|
||||
test3();
|
||||
test4();
|
||||
|
||||
while (gtk_window_list_toplevels ())
|
||||
g_main_context_iteration (NULL, TRUE);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user