From fa7f36b49124514a7ba26794c1d0caf3cb71b707 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 31 Jan 2013 16:14:43 +0000 Subject: [PATCH] window: Optimise title click check to only the cases where we have a title --- gtk/gtkwindow.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index cdc1ddab10..4a8c7e6fb1 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -6265,12 +6265,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) { @@ -6285,19 +6279,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;