[gtk+] Fix a problem with window dragging



commit 8bd94a9515f0ca861a56f2f52a91a4b2b5ea96b1
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Feb 15 20:41:58 2014 -0500

    Fix a problem with window dragging
    
    Dragging windows was not working on widgets in the titlebar
    region unless they had the window-dragging style property
    set. Fix this by looking at the region for motion notify
    events as well as for buton press events.

 gtk/gtkwindow.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index dd18922..a12e8d0 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -7687,6 +7687,8 @@ gtk_window_motion_notify_event (GtkWidget      *widget,
   GtkWindowPrivate *priv = GTK_WINDOW (widget)->priv;
   GtkWidget *src;
   gboolean window_drag;
+  gint x, y;
+  GtkWindowRegion region;
 
   if (!priv->drag_possible)
     return FALSE;
@@ -7697,6 +7699,17 @@ gtk_window_motion_notify_event (GtkWidget      *widget,
       gtk_widget_style_get (GTK_WIDGET (src),
                             "window-dragging", &window_drag,
                             NULL);
+      gtk_widget_translate_coordinates (src, widget, event->x, event->y, &x, &y);
+    }
+  else
+    {
+      x = event->x;
+      y = event->y;
+    }
+
+  region = get_active_region_type (GTK_WINDOW (widget), (GdkEventAny*)event, x, y);
+  if (region == GTK_WINDOW_REGION_CONTENT)
+    {
       if (!window_drag)
         {
           priv->drag_possible = FALSE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]