Remove pointless inout arguments

GtkTreeView.get_tooltip_context() takes an inout X and Y coordinates,
but the "out" side is a side effect: the conversion from widget-relative
to bin window-relative coordinates is not documented, and can be done
using public API, if needed.

GtkIconView.get_tooltip_context() follows the same pattern, and takes
two inout arguments for the coordinates, but it does not change them any
more, after GtkIconView's bin window was dropped in commit 8dc5e13e.

There's really no point in having these `inout` arguments, and while
GtkTreeView and GtkIconView are certainly de-emphasised in GTK4, and we
nudge developers to move to the new list views, we should take advantage
of the API break to remove warts.
This commit is contained in:
Emmanuele Bassi 2020-11-17 14:40:52 +00:00
parent 2b8c3731c1
commit 153c6424d3
7 changed files with 30 additions and 24 deletions

View File

@ -1136,6 +1136,14 @@ gtk_buildable_get_buildable_id().
GtkAboutDialog now directly derives from GtkWindow, the GtkDialog API can no
longer be used on it.
### Adapt to GtkTreeView and GtkIconView tooltip context changes
The getter functions for retrieving the data from #GtkTreeView
and #GtkIconView inside a #GtkWidget::query-tooltip signal do not take the
pointer coordinates as inout arguments any more, but as normal in ones.
See: gtk_tree_view_get_tooltip_context(), gtk_icon_view_get_tooltip_context()
## Changes to consider after the switch
GTK 4 has a number of new features that you may want to take

View File

@ -2111,7 +2111,7 @@ file_list_query_tooltip_cb (GtkWidget *widget,
if (!gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (impl->browse_files_tree_view),
&x, &y,
x, y,
keyboard_tip,
&model, &path, &iter))
return FALSE;

View File

@ -4254,8 +4254,8 @@ gtk_icon_view_set_tooltip_cell (GtkIconView *icon_view,
/**
* gtk_icon_view_get_tooltip_context:
* @icon_view: an #GtkIconView
* @x: (inout): the x coordinate (relative to widget coordinates)
* @y: (inout): the y coordinate (relative to widget coordinates)
* @x: the x coordinate (relative to widget coordinates)
* @y: the y coordinate (relative to widget coordinates)
* @keyboard_tip: whether this is a keyboard tooltip or not
* @model: (out) (allow-none) (transfer none): a pointer to receive a
* #GtkTreeModel or %NULL
@ -4277,8 +4277,8 @@ gtk_icon_view_set_tooltip_cell (GtkIconView *icon_view,
*/
gboolean
gtk_icon_view_get_tooltip_context (GtkIconView *icon_view,
int *x,
int *y,
int x,
int y,
gboolean keyboard_tip,
GtkTreeModel **model,
GtkTreePath **path,
@ -4287,8 +4287,6 @@ gtk_icon_view_get_tooltip_context (GtkIconView *icon_view,
GtkTreePath *tmppath = NULL;
g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), FALSE);
g_return_val_if_fail (x != NULL, FALSE);
g_return_val_if_fail (y != NULL, FALSE);
if (keyboard_tip)
{
@ -4299,7 +4297,7 @@ gtk_icon_view_get_tooltip_context (GtkIconView *icon_view,
}
else
{
if (!gtk_icon_view_get_item_at_pos (icon_view, *x, *y, &tmppath, NULL))
if (!gtk_icon_view_get_item_at_pos (icon_view, x, y, &tmppath, NULL))
return FALSE;
}
@ -4333,7 +4331,7 @@ gtk_icon_view_set_tooltip_query_cb (GtkWidget *widget,
GtkIconView *icon_view = GTK_ICON_VIEW (widget);
if (!gtk_icon_view_get_tooltip_context (GTK_ICON_VIEW (widget),
&x, &y,
x, y,
keyboard_tip,
&model, &path, &iter))
return FALSE;

View File

@ -268,8 +268,8 @@ void gtk_icon_view_set_tooltip_cell (GtkIconView *
GtkCellRenderer *cell);
GDK_AVAILABLE_IN_ALL
gboolean gtk_icon_view_get_tooltip_context (GtkIconView *icon_view,
int *x,
int *y,
int x,
int y,
gboolean keyboard_tip,
GtkTreeModel **model,
GtkTreePath **path,

View File

@ -14676,8 +14676,8 @@ gtk_tree_view_set_tooltip_cell (GtkTreeView *tree_view,
/**
* gtk_tree_view_get_tooltip_context:
* @tree_view: a #GtkTreeView
* @x: (inout): the x coordinate (relative to widget coordinates)
* @y: (inout): the y coordinate (relative to widget coordinates)
* @x: the x coordinate (relative to widget coordinates)
* @y: the y coordinate (relative to widget coordinates)
* @keyboard_tip: whether this is a keyboard tooltip or not
* @model: (out) (optional) (nullable) (transfer none): a pointer to
* receive a #GtkTreeModel or %NULL
@ -14700,8 +14700,8 @@ gtk_tree_view_set_tooltip_cell (GtkTreeView *tree_view,
*/
gboolean
gtk_tree_view_get_tooltip_context (GtkTreeView *tree_view,
int *x,
int *y,
int x,
int y,
gboolean keyboard_tip,
GtkTreeModel **model,
GtkTreePath **path,
@ -14710,8 +14710,6 @@ gtk_tree_view_get_tooltip_context (GtkTreeView *tree_view,
GtkTreePath *tmppath = NULL;
g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
g_return_val_if_fail (x != NULL, FALSE);
g_return_val_if_fail (y != NULL, FALSE);
if (keyboard_tip)
{
@ -14722,10 +14720,12 @@ gtk_tree_view_get_tooltip_context (GtkTreeView *tree_view,
}
else
{
gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, *x, *y,
x, y);
int rel_x, rel_y;
if (!gtk_tree_view_get_path_at_pos (tree_view, *x, *y,
gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y,
&rel_x, &rel_y);
if (!gtk_tree_view_get_path_at_pos (tree_view, rel_x, rel_y,
&tmppath, NULL, NULL, NULL))
return FALSE;
}
@ -14762,7 +14762,7 @@ gtk_tree_view_set_tooltip_query_cb (GtkWidget *widget,
GtkTreeViewPrivate *priv = gtk_tree_view_get_instance_private (tree_view);
if (!gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (widget),
&x, &y,
x, y,
keyboard_tip,
&model, &path, &iter))
return FALSE;

View File

@ -528,8 +528,8 @@ void gtk_tree_view_set_tooltip_cell (GtkTreeView *tree_view,
GtkCellRenderer *cell);
GDK_AVAILABLE_IN_ALL
gboolean gtk_tree_view_get_tooltip_context(GtkTreeView *tree_view,
int *x,
int *y,
int x,
int y,
gboolean keyboard_tip,
GtkTreeModel **model,
GtkTreePath **path,

View File

@ -125,7 +125,7 @@ query_tooltip_tree_view_cb (GtkWidget *widget,
char buffer[512];
if (!gtk_tree_view_get_tooltip_context (tree_view, &x, &y,
if (!gtk_tree_view_get_tooltip_context (tree_view, x, y,
keyboard_tip,
&model, &path, &iter))
return FALSE;