[glade] GladeFixed: Explicitly fetch mouse position at add_child time
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] GladeFixed: Explicitly fetch mouse position at add_child time
- Date: Wed, 3 Apr 2013 19:18:11 +0000 (UTC)
commit c9040f87a5cefd6c979056a69768e7062233c026
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Thu Apr 4 04:14:59 2013 +0900
GladeFixed: Explicitly fetch mouse position at add_child time
This is because normal event recording doesnt work when a GTK+
Drag and Drop is in progress, so we need to explicitly fetch
the pointer position at Drop time.
plugins/gtk+/glade-fixed.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/plugins/gtk+/glade-fixed.c b/plugins/gtk+/glade-fixed.c
index c8fed9f..bc3b4a9 100644
--- a/plugins/gtk+/glade-fixed.c
+++ b/plugins/gtk+/glade-fixed.c
@@ -683,7 +683,7 @@ glade_fixed_handle_child_event (GladeFixed *fixed,
gint fixed_x, fixed_y, child_x, child_y;
GdkDevice *device;
- device = glade_widget_get_device_from_event (event);
+ device = gdk_event_get_device (event);
glade_utils_get_pointer (fixed_widget,
window,
@@ -726,7 +726,7 @@ glade_fixed_handle_child_event (GladeFixed *fixed,
{
/* Need to update mouse for configures. */
glade_utils_get_pointer (fixed_widget,
- window, glade_widget_get_device_from_event (event),
+ window, gdk_event_get_device (event),
&fixed->mouse_x, &fixed->mouse_y);
glade_fixed_configure_widget (fixed, child, event->motion.device);
@@ -838,10 +838,22 @@ glade_fixed_add_child_impl (GladeWidget *gwidget_fixed,
GtkAllocation allocation;
GdkRectangle rect;
gboolean handled;
+ GtkWidget *widget;
+ GdkWindow *window;
+ GdkDevice *device;
+ GdkEvent *event;
g_return_if_fail (GLADE_IS_FIXED (fixed));
g_return_if_fail (GLADE_IS_WIDGET (child));
+ /* Need to explicitly find the pointer location at drag_drop time */
+ widget = GTK_WIDGET (glade_widget_get_object (gwidget_fixed));
+ window = gtk_widget_get_window (widget);
+ event = gtk_get_current_event ();
+ if ((device = gdk_event_get_device (event)))
+ glade_utils_get_pointer (widget, window, device, &fixed->mouse_x, &fixed->mouse_y);
+ gdk_event_free (event);
+
/* Chain up for the basic parenting */
GLADE_WIDGET_CLASS (parent_class)->add_child
(GLADE_WIDGET (fixed), child, at_mouse);
@@ -941,7 +953,7 @@ glade_fixed_event (GladeWidget *gwidget_fixed, GdkEvent *event)
if (GLADE_WIDGET_CLASS (parent_class)->event (gwidget_fixed, event))
return TRUE;
- if ((device = glade_widget_get_device_from_event (event)))
+ if ((device = gdk_event_get_device (event)))
{
/* Need to update mouse for configures. */
glade_utils_get_pointer (GTK_WIDGET (glade_widget_get_object (gwidget_fixed)),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]