[gtk+/composite-templates] treeview: fix size of the dragged column header
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/composite-templates] treeview: fix size of the dragged column header
- Date: Sat, 6 Oct 2012 17:08:40 +0000 (UTC)
commit 79d6b66684584daa56084aec51d93a46a9cc5a93
Author: Stefano Facchini <stefano facchini gmail com>
Date: Thu Sep 27 16:44:19 2012 +0200
treeview: fix size of the dragged column header
Currently the GdkWindow used for dragging is created once when
the first drag starts, and the reused identical each time.
Instead, just recreate it for each drag, with the correct size.
gtk/gtktreeview.c | 40 +++++++++++++++++++---------------------
1 files changed, 19 insertions(+), 21 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 263fe59..8217eb7 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -3317,7 +3317,8 @@ gtk_tree_view_button_release_drag_column (GtkWidget *widget,
tree_view->priv->cur_reorder->left_column);
}
tree_view->priv->drag_column = NULL;
- gdk_window_hide (tree_view->priv->drag_window);
+ gdk_window_destroy (tree_view->priv->drag_window);
+ tree_view->priv->drag_window = NULL;
for (l = tree_view->priv->column_drag_info; l != NULL; l = l->next)
g_slice_free (GtkTreeViewColumnReorder, l->data);
@@ -9787,9 +9788,12 @@ _gtk_tree_view_column_start_drag (GtkTreeView *tree_view,
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (tree_view));
GtkWidget *button;
GdkDevice *pointer, *keyboard;
+ GdkWindowAttr attributes;
+ guint attributes_mask;
g_return_if_fail (tree_view->priv->column_drag_info == NULL);
g_return_if_fail (tree_view->priv->cur_reorder == NULL);
+ g_return_if_fail (tree_view->priv->drag_window == NULL);
gtk_tree_view_set_column_drag_info (tree_view, column);
@@ -9798,28 +9802,22 @@ _gtk_tree_view_column_start_drag (GtkTreeView *tree_view,
button = gtk_tree_view_column_get_button (column);
- if (tree_view->priv->drag_window == NULL)
- {
- GdkWindowAttr attributes;
- guint attributes_mask;
-
- gtk_widget_get_allocation (button, &button_allocation);
+ gtk_widget_get_allocation (button, &button_allocation);
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.x = button_allocation.x;
- attributes.y = 0;
- attributes.width = button_allocation.width;
- attributes.height = button_allocation.height;
- attributes.visual = gtk_widget_get_visual (GTK_WIDGET (tree_view));
- attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK;
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
+ attributes.window_type = GDK_WINDOW_CHILD;
+ attributes.wclass = GDK_INPUT_OUTPUT;
+ attributes.x = button_allocation.x;
+ attributes.y = 0;
+ attributes.width = button_allocation.width;
+ attributes.height = button_allocation.height;
+ attributes.visual = gtk_widget_get_visual (GTK_WIDGET (tree_view));
+ attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK;
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
- tree_view->priv->drag_window = gdk_window_new (tree_view->priv->bin_window,
- &attributes,
- attributes_mask);
- gdk_window_set_user_data (tree_view->priv->drag_window, GTK_WIDGET (tree_view));
- }
+ tree_view->priv->drag_window = gdk_window_new (tree_view->priv->bin_window,
+ &attributes,
+ attributes_mask);
+ gdk_window_set_user_data (tree_view->priv->drag_window, GTK_WIDGET (tree_view));
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]