summaryrefslogtreecommitdiff
path: root/gtk/gtkpaned.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2011-11-08 16:47:08 +0100
committerBenjamin Otte <otte@redhat.com>2011-11-08 21:14:06 +0100
commit28d0403f1767921ee86d98ac7aba66b1122f51a6 (patch)
treebfa095a9ec82b2144140ac2349f79c94d5b2fc34 /gtk/gtkpaned.c
parent80a23a2f2b3dab8d2b4fbcae74e933d47cb1eb49 (diff)
downloadgtk+-28d0403f1767921ee86d98ac7aba66b1122f51a6.tar.gz
paned: Pass x/y position to update_drag()
This way we get the coordinates from the right device instead of using any random device.
Diffstat (limited to 'gtk/gtkpaned.c')
-rw-r--r--gtk/gtkpaned.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 45e7859caf..5372a9fc14 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -1520,7 +1520,9 @@ is_rtl (GtkPaned *paned)
static void
update_drag (GtkPaned *paned,
- GdkEventCrossing *crossing)
+ /* relative to priv->handle */
+ int xpos,
+ int ypos)
{
GtkPanedPrivate *priv = paned->priv;
GtkAllocation allocation;
@@ -1528,11 +1530,18 @@ update_drag (GtkPaned *paned,
gint pos;
gint handle_size;
gint size;
+ gint x, y;
+ gdk_window_get_position (priv->handle, &x, &y);
+ gtk_widget_get_allocation (widget, &allocation);
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_widget_get_pointer (widget, &pos, NULL);
+ {
+ pos = xpos + x - allocation.x;
+ }
else
- gtk_widget_get_pointer (widget, NULL, &pos);
+ {
+ pos = ypos + y - allocation.y;
+ }
pos -= priv->drag_pos;
@@ -1542,7 +1551,6 @@ update_drag (GtkPaned *paned,
"handle-size", &handle_size,
NULL);
- gtk_widget_get_allocation (widget, &allocation);
size = allocation.width - pos - handle_size;
}
else
@@ -1564,7 +1572,7 @@ gtk_paned_enter (GtkWidget *widget,
GtkPanedPrivate *priv = paned->priv;
if (priv->in_drag)
- update_drag (paned, event);
+ update_drag (paned, event->x, event->y);
else
{
priv->handle_prelit = TRUE;
@@ -1586,7 +1594,7 @@ gtk_paned_leave (GtkWidget *widget,
GtkPanedPrivate *priv = paned->priv;
if (priv->in_drag)
- update_drag (paned);
+ update_drag (paned, event->x, event->y);
else
{
priv->handle_prelit = FALSE;
@@ -1747,7 +1755,7 @@ gtk_paned_motion (GtkWidget *widget,
if (priv->in_drag)
{
- update_drag (paned);
+ update_drag (paned, event->x, event->y);
return TRUE;
}