[gtk+] Some more resize grip cleanups
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Some more resize grip cleanups
- Date: Wed, 13 Oct 2010 14:40:32 +0000 (UTC)
commit 7d5a85c3ad6ba6aa891edcafd8cdb3d397184002
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Oct 13 10:39:09 2010 -0400
Some more resize grip cleanups
Don't recompute hints whenever we determine the drag edge, and
take the drag edge into account when deciding whether to show
the grip.
gtk/gtkwindow.c | 40 ++++++++++++++++++++++++----------------
1 files changed, 24 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index edf58dd..a27b474 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -3035,7 +3035,7 @@ gtk_window_set_geometry_hints (GtkWindow *window,
{
gtk_window_set_gravity (window, geometry->win_gravity);
}
-
+
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (window));
}
@@ -5021,23 +5021,26 @@ static gboolean
get_drag_edge (GtkWidget *widget,
GdkWindowEdge *edge)
{
- GdkGeometry geometry;
- guint flags;
+ GtkWindowPrivate *priv = GTK_WINDOW (widget)->priv;
gboolean hresizable;
gboolean vresizable;
GtkTextDirection dir;
+ GtkWindowGeometryInfo *info;
- gtk_window_compute_hints (GTK_WINDOW (widget), &geometry, &flags);
+ hresizable = TRUE;
+ vresizable = TRUE;
- if ((flags & GDK_HINT_MIN_SIZE) && (flags & GDK_HINT_MAX_SIZE))
- {
- hresizable = geometry.min_width < geometry.max_width;
- vresizable = geometry.min_height < geometry.max_height;
- }
- else
+ info = priv->geometry_info;
+ if (info)
{
- hresizable = TRUE;
- vresizable = TRUE;
+ GdkWindowHints flags = info->last.flags;
+ GdkGeometry *geometry = &info->last.geometry;
+
+ if ((flags & GDK_HINT_MIN_SIZE) && (flags & GDK_HINT_MAX_SIZE))
+ {
+ hresizable = geometry->min_width < geometry->max_width;
+ vresizable = geometry->min_height < geometry->max_height;
+ }
}
dir = gtk_widget_get_direction (widget);
@@ -5487,11 +5490,14 @@ update_grip_visibility (GtkWindow *window)
gboolean
gtk_window_resize_grip_is_visible (GtkWindow *window)
{
+ GtkWidget *widget;
GtkWindowPrivate *priv;
+ GdkWindowEdge *edge;
g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
priv = window->priv;
+ widget = GTK_WIDGET (window);
if (priv->type == GTK_WINDOW_POPUP)
return FALSE;
@@ -5499,16 +5505,19 @@ gtk_window_resize_grip_is_visible (GtkWindow *window)
if (!priv->resizable)
return FALSE;
- if (gtk_widget_get_realized (GTK_WIDGET (window)))
+ if (gtk_widget_get_realized (widget))
{
GdkWindowState state;
- state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (window)));
+ state = gdk_window_get_state (gtk_widget_get_window (widget));
if (state & GDK_WINDOW_STATE_MAXIMIZED || state & GDK_WINDOW_STATE_FULLSCREEN)
return FALSE;
}
+ if (!get_drag_edge (widget, &edge))
+ return FALSE;
+
return window->priv->has_resize_grip;
}
@@ -7976,8 +7985,7 @@ gtk_window_set_resizable (GtkWindow *window,
{
priv->resizable = (resizable != FALSE);
- if (priv->grip_window != NULL)
- update_grip_visibility (window);
+ update_grip_visibility (window);
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (window));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]