[gtk+/wip/csd] window: Optimise title click check to only the cases where we have a title



commit cb265a58fe903c6f696f1e756848c2dc93547d39
Author: Rob Bradford <rob linux intel com>
Date:   Thu Jan 31 16:14:43 2013 +0000

    window: Optimise title click check to only the cases where we have a title

 gtk/gtkwindow.c |   38 +++++++++++++++++++++-----------------
 1 files changed, 21 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 568f61b..9205247 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -6311,12 +6311,6 @@ gtk_window_button_press_event (GtkWidget *widget,
 {
   GtkWindowPrivate *priv = GTK_WINDOW (widget)->priv;
   GdkWindowEdge edge;
-  GtkAllocation allocation;
-  int border_width;
-
-  gtk_widget_get_allocation (priv->title_box, &allocation);
-  border_width =
-    gtk_container_get_border_width (GTK_CONTAINER (priv->title_box));
 
   if (event->window == priv->grip_window)
     {
@@ -6331,19 +6325,29 @@ gtk_window_button_press_event (GtkWidget *widget,
 
       return TRUE;
     }
-  else if (allocation.x - border_width <= event->x &&
-	   event->x < allocation.x + border_width + allocation.width &&
-	   allocation.y - border_width <= event->y &&
-	   event->y < allocation.y + border_width + allocation.height)
+  else if (priv->client_decorated && priv->decorated && priv->title_box)
     {
-      gdk_window_begin_move_drag_for_device (gtk_widget_get_window(widget),
-					     gdk_event_get_device((GdkEvent *) event),
-					     event->button,
-					     event->x_root,
-					     event->y_root,
-					     event->time);
+      GtkAllocation allocation;
+      int border_width;
 
-      return TRUE;
+      gtk_widget_get_allocation (priv->title_box, &allocation);
+      border_width =
+        gtk_container_get_border_width (GTK_CONTAINER (priv->title_box));
+
+      if (allocation.x - border_width <= event->x &&
+          event->x < allocation.x + border_width + allocation.width &&
+          allocation.y - border_width <= event->y &&
+          event->y < allocation.y + border_width + allocation.height)
+        {
+          gdk_window_begin_move_drag_for_device (gtk_widget_get_window(widget),
+                                                 gdk_event_get_device((GdkEvent *) event),
+                                                 event->button,
+                                                 event->x_root,
+                                                 event->y_root,
+                                                 event->time);
+
+          return TRUE;
+        }
     }
 
   return FALSE;



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