Merge branch 'wip/otte/for-master' into 'master'

Wip/otte/for master

See merge request GNOME/gtk!1388
This commit is contained in:
Benjamin Otte 2020-02-04 17:48:58 +00:00
commit 3f7e409428
5 changed files with 36 additions and 20 deletions

View File

@ -34,10 +34,30 @@
* #GtkMapListModel is a list model that takes a list model and maps the items
* in that model to different items according to a #GtkMapListModelMapFunc.
*
* FIXME: Add useful examples here, like turning #GFile into #GFileInfo or #GdkPixmap.
* Example: Create a list of #GtkEventControllers
* |[
* static gpointer
* map_to_controllers (gpointer widget,
* gpointer data)
* {
* gpointer result = gtk_widget_observe_controllers (widget);
* g_object_unref (widget);
* return result;
* }
*
* #GtkMapListModel will attempt to discard the mapped objects as soon as they are no
* longer needed and recreate them if necessary.
* widgets = gtk_widget_observe_children (widget);
*
* controllers = gtk_map_list_model_new (G_TYPE_LIST_MODEL,
* widgets,
* map_to_controllers,
* NULL, NULL);
*
* model = gtk_flatten_list_model_new (GTK_TYPE_EVENT_CONTROLLER,
* controllers);
* ]|
*
* #GtkMapListModel will attempt to discard the mapped objects as soon as
* they are no longer needed and recreate them if necessary.
*/
enum {

View File

@ -932,7 +932,7 @@ gtk_tree_list_model_get_child_row (GtkTreeListModel *self,
/**
* SECTION:gtktreelistrow
* @Short_description: rows in a tree
* @Short_description: A row in a GtkTreeListModel
* @Title: GtkTreeListRow
* @See_also: #GtkTreeListModel
*
@ -941,7 +941,7 @@ gtk_tree_list_model_get_child_row (GtkTreeListModel *self,
* modify the state of rows.
*
* #GtkTreeListRow instances are created by a #GtkTreeListModel only
* when the GtkTreeListModel:passthrough property is not set.
* when the #GtkTreeListModel:passthrough property is not set.
*
* There are various support objects that can make use of #GtkTreeListRow
* objects, such as the #GtkTreeExpander widget that allows displaying

View File

@ -2587,7 +2587,7 @@ gtk_widget_unparent (GtkWidget *widget)
if (gtk_widget_get_focus_child (priv->parent) == widget)
gtk_widget_set_focus_child (priv->parent, NULL);
if (_gtk_widget_is_drawable (priv->parent))
if (_gtk_widget_get_mapped (priv->parent))
gtk_widget_queue_draw (priv->parent);
if (priv->visible && _gtk_widget_get_visible (priv->parent))
@ -4372,7 +4372,7 @@ gtk_widget_real_can_activate_accel (GtkWidget *widget,
/* widgets must be onscreen for accels to take effect */
return gtk_widget_is_sensitive (widget) &&
_gtk_widget_is_drawable (widget) &&
_gtk_widget_get_mapped (widget) &&
gdk_surface_is_viewable (priv->surface);
}
@ -10424,7 +10424,7 @@ gtk_widget_contains (GtkWidget *widget,
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
if (!_gtk_widget_is_drawable (widget))
if (!_gtk_widget_get_mapped (widget))
return FALSE;
return GTK_WIDGET_GET_CLASS (widget)->contains (widget, x, y);
@ -10435,7 +10435,7 @@ static gboolean
gtk_widget_can_be_picked (GtkWidget *widget,
GtkPickFlags flags)
{
if (!_gtk_widget_is_drawable (widget))
if (!_gtk_widget_get_mapped (widget))
return FALSE;
if (!(flags & GTK_PICK_NON_TARGETABLE) &&
@ -12205,7 +12205,7 @@ gtk_widget_snapshot (GtkWidget *widget,
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
if (!_gtk_widget_is_drawable (widget))
if (!_gtk_widget_get_mapped (widget))
return;
if (_gtk_widget_get_alloc_needed (widget))
@ -12593,6 +12593,9 @@ gtk_widget_snapshot_child (GtkWidget *widget,
if (GTK_IS_NATIVE (child))
return;
if (!_gtk_widget_get_mapped (child))
return;
if (priv->transform)
{
gtk_snapshot_save (snapshot);

View File

@ -418,13 +418,12 @@ gtk_widget_focus_sort (GtkWidget *widget,
if (focus_order->len == 0)
{
/* Initialize the list with all realized child widgets */
/* Initialize the list with all visible child widgets */
for (child = _gtk_widget_get_first_child (widget);
child != NULL;
child = _gtk_widget_get_next_sibling (child))
{
if (_gtk_widget_get_realized (child) &&
_gtk_widget_is_drawable (child) &&
if (_gtk_widget_get_mapped (child) &&
gtk_widget_get_sensitive (child))
g_ptr_array_add (focus_order, child);
}
@ -475,7 +474,7 @@ gtk_widget_focus_move (GtkWidget *widget,
ret = gtk_widget_child_focus (child, direction);
}
}
else if (_gtk_widget_is_drawable (child) &&
else if (_gtk_widget_get_mapped (child) &&
gtk_widget_is_ancestor (child, widget))
{
ret = gtk_widget_child_focus (child, direction);

View File

@ -381,12 +381,6 @@ _gtk_widget_get_mapped (GtkWidget *widget)
return widget->priv->mapped;
}
static inline gboolean
_gtk_widget_is_drawable (GtkWidget *widget)
{
return widget->priv->visible && widget->priv->mapped;
}
static inline gboolean
_gtk_widget_get_realized (GtkWidget *widget)
{