[gtk+/gtk-3-18] treeview: Make sure the editing widget's top left is always visible
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-18] treeview: Make sure the editing widget's top left is always visible
- Date: Sun, 14 Feb 2016 14:01:22 +0000 (UTC)
commit 322c4e1698a01c70d6d55b47d366e8e2661a182d
Author: Colomban Wendling <ban herbesfolles org>
Date: Wed Feb 10 19:43:34 2016 +0100
treeview: Make sure the editing widget's top left is always visible
https://bugzilla.gnome.org/show_bug.cgi?id=761838
gtk/gtktreeview.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index c2f4589..0c239c6 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -2950,6 +2950,7 @@ gtk_tree_view_size_allocate (GtkWidget *widget,
GtkTreeViewChild *child = tmp_list->data;
GtkTreePath *path;
GdkRectangle child_rect;
+ int min_x, max_x, min_y, max_y;
int size;
path = _gtk_tree_path_new_from_rbtree (child->tree, child->node);
@@ -2975,6 +2976,14 @@ gtk_tree_view_size_allocate (GtkWidget *widget,
child_rect.height += size;
}
+ /* push the rect back in the visible area if needed, preferring the top left corner */
+ min_x = gtk_adjustment_get_value (tree_view->priv->hadjustment);
+ max_x = min_x + allocation->width - child_rect.width;
+ min_y = 0;
+ max_y = min_y + allocation->height - gtk_tree_view_get_effective_header_height (tree_view) -
child_rect.height;
+ child_rect.x = MAX (min_x, MIN (child_rect.x, max_x));
+ child_rect.y = MAX (min_y, MIN (child_rect.y, max_y));
+
gtk_tree_path_free (path);
gtk_widget_size_allocate (child->widget, &child_rect);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]