de6fb34644
Should resolve https://bugzilla.redhat.com/show_bug.cgi?id=674978
192 lines
8.0 KiB
Diff
192 lines
8.0 KiB
Diff
From 6450a2100767b9d37ebe504e87d9fd5aec5111ff Mon Sep 17 00:00:00 2001
|
|
From: Ray Strode <rstrode@redhat.com>
|
|
Date: Mon, 14 Feb 2011 11:45:13 -0500
|
|
Subject: [PATCH 1/2] greeter: drop child_adjustments_stale thing
|
|
|
|
When the greeter went to gtk3, the bit of code that toggled this
|
|
boolean got dropped, so it was never TRUE. That means all the places
|
|
that check the boolean are dead code that can be pruned.
|
|
---
|
|
gui/simple-greeter/gdm-scrollable-widget.c | 7 -------
|
|
1 files changed, 0 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/gui/simple-greeter/gdm-scrollable-widget.c b/gui/simple-greeter/gdm-scrollable-widget.c
|
|
index 1f8e807..dc464af 100644
|
|
--- a/gui/simple-greeter/gdm-scrollable-widget.c
|
|
+++ b/gui/simple-greeter/gdm-scrollable-widget.c
|
|
@@ -61,8 +61,6 @@ struct GdmScrollableWidgetPrivate
|
|
int forced_height;
|
|
|
|
GQueue *key_event_queue;
|
|
-
|
|
- guint child_adjustments_stale : 1;
|
|
};
|
|
|
|
struct GdmScrollableWidgetAnimation
|
|
@@ -260,10 +258,6 @@ gdm_scrollable_widget_needs_scrollbar (GdmScrollableWidget *widget)
|
|
return FALSE;
|
|
}
|
|
|
|
- if (widget->priv->child_adjustments_stale) {
|
|
- return FALSE;
|
|
- }
|
|
-
|
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
|
if (child != NULL) {
|
|
int available_height;
|
|
@@ -463,7 +457,6 @@ gdm_scrollable_widget_size_allocate (GtkWidget *widget,
|
|
|
|
gtk_widget_size_allocate (child,
|
|
&child_allocation);
|
|
- scrollable_widget->priv->child_adjustments_stale = FALSE;
|
|
}
|
|
}
|
|
|
|
--
|
|
1.7.4
|
|
|
|
|
|
From b37803d0436a5ff651415cb4fbb20813b91f4940 Mon Sep 17 00:00:00 2001
|
|
From: Ray Strode <rstrode@redhat.com>
|
|
Date: Mon, 14 Feb 2011 11:51:20 -0500
|
|
Subject: [PATCH 2/2] greeter: more gtk3 fixes
|
|
|
|
This commit drops use of the deprecated xthickness
|
|
and ythickness properties throughout, and fixes
|
|
padding and border calculations in various places,
|
|
---
|
|
gui/simple-greeter/gdm-scrollable-widget.c | 66 +++++++++++++++++++++-------
|
|
1 files changed, 50 insertions(+), 16 deletions(-)
|
|
|
|
diff --git a/gui/simple-greeter/gdm-scrollable-widget.c b/gui/simple-greeter/gdm-scrollable-widget.c
|
|
index dc464af..da813f1 100644
|
|
--- a/gui/simple-greeter/gdm-scrollable-widget.c
|
|
+++ b/gui/simple-greeter/gdm-scrollable-widget.c
|
|
@@ -135,10 +135,20 @@ on_animation_tick (GdmScrollableWidgetAnimation *animation,
|
|
|
|
if (animation->step_func != NULL) {
|
|
GdmTimer *timer;
|
|
+ GtkStyleContext *context;
|
|
+ GtkStateFlags state;
|
|
+ GtkBorder padding, border;
|
|
|
|
height = animation->desired_height;
|
|
|
|
- height -= gtk_widget_get_style (animation->widget)->ythickness * 2;
|
|
+ context = gtk_widget_get_style_context (animation->widget);
|
|
+ state = gtk_widget_get_state_flags (animation->widget);
|
|
+
|
|
+ gtk_style_context_get_padding (context, state, &padding);
|
|
+ gtk_style_context_get_border (context, state, &border);
|
|
+
|
|
+ height -= padding.top + padding.bottom;
|
|
+ height -= border.top + border.bottom;
|
|
|
|
timer = g_object_ref (animation->timer);
|
|
animation->step_func (GDM_SCROLLABLE_WIDGET (animation->widget),
|
|
@@ -147,7 +157,8 @@ on_animation_tick (GdmScrollableWidgetAnimation *animation,
|
|
animation->step_func_user_data);
|
|
|
|
if (gdm_timer_is_started (timer)) {
|
|
- height += gtk_widget_get_style (animation->widget)->ythickness * 2;
|
|
+ height += padding.top + padding.bottom;
|
|
+ height += border.top + border.bottom;
|
|
|
|
animation->desired_height = height;
|
|
}
|
|
@@ -259,11 +270,23 @@ gdm_scrollable_widget_needs_scrollbar (GdmScrollableWidget *widget)
|
|
}
|
|
|
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
|
- if (child != NULL) {
|
|
+ if (child != NULL && GTK_IS_SCROLLABLE (child)) {
|
|
+ GtkStyleContext *context;
|
|
+ GtkStateFlags state;
|
|
+ GtkBorder padding, border;
|
|
int available_height;
|
|
int child_scrolled_height;
|
|
|
|
+ context = gtk_widget_get_style_context (GTK_WIDGET (widget));
|
|
+ state = gtk_widget_get_state_flags (GTK_WIDGET (widget));
|
|
+
|
|
+ gtk_style_context_get_padding (context, state, &padding);
|
|
+ gtk_style_context_get_border (context, state, &border);
|
|
+
|
|
available_height = gtk_widget_get_allocated_height (GTK_WIDGET (widget));
|
|
+ available_height -= padding.top + padding.bottom;
|
|
+ available_height -= border.top + border.bottom;
|
|
+
|
|
gtk_widget_get_preferred_height (child, NULL, &child_scrolled_height);
|
|
needs_scrollbar = child_scrolled_height > available_height;
|
|
} else {
|
|
@@ -295,10 +318,21 @@ gdm_scrollable_widget_get_preferred_size (GtkWidget *widget,
|
|
gtk_style_context_get_border (context, state, &border);
|
|
|
|
scrollable_widget = GDM_SCROLLABLE_WIDGET (widget);
|
|
+
|
|
+ minimum_req.width = padding.left + padding.right;
|
|
+ minimum_req.width += border.left + border.right;
|
|
+ minimum_req.height = padding.top + padding.bottom;
|
|
+ minimum_req.height += border.top + border.bottom;
|
|
+
|
|
+ natural_req.width = padding.left + padding.right;
|
|
+ natural_req.width += border.left + border.right;
|
|
+ natural_req.height = padding.top + padding.bottom;
|
|
+ natural_req.height += border.top + border.bottom;
|
|
+
|
|
if (orientation == GTK_ORIENTATION_VERTICAL
|
|
&& scrollable_widget->priv->forced_height >= 0) {
|
|
- minimum_req.height = scrollable_widget->priv->forced_height;
|
|
- natural_req.height = scrollable_widget->priv->forced_height;
|
|
+ minimum_req.height += scrollable_widget->priv->forced_height;
|
|
+ natural_req.height += scrollable_widget->priv->forced_height;
|
|
} else {
|
|
child = gtk_bin_get_child (GTK_BIN (widget));
|
|
|
|
@@ -306,16 +340,6 @@ gdm_scrollable_widget_get_preferred_size (GtkWidget *widget,
|
|
&scrollbar_requisition,
|
|
NULL);
|
|
|
|
- minimum_req.width = padding.left + padding.right;
|
|
- minimum_req.width = border.left + border.right;
|
|
- minimum_req.height = padding.top + padding.bottom;
|
|
- minimum_req.height = border.top + border.bottom;
|
|
-
|
|
- natural_req.width = padding.left + padding.right;
|
|
- natural_req.width = border.left + border.right;
|
|
- natural_req.height = padding.top + padding.bottom;
|
|
- natural_req.height = border.top + border.bottom;
|
|
-
|
|
if (child && gtk_widget_get_visible (child)) {
|
|
if (orientation == GTK_ORIENTATION_HORIZONTAL) {
|
|
gtk_widget_get_preferred_width (child,
|
|
@@ -815,6 +839,9 @@ gdm_scrollable_widget_slide_to_height (GdmScrollableWidget *scrollable_widget,
|
|
GtkWidget *widget;
|
|
gboolean input_redirected;
|
|
GtkAllocation widget_allocation;
|
|
+ GtkStyleContext *context;
|
|
+ GtkStateFlags state;
|
|
+ GtkBorder padding, border;
|
|
|
|
g_return_if_fail (GDM_IS_SCROLLABLE_WIDGET (scrollable_widget));
|
|
widget = GTK_WIDGET (scrollable_widget);
|
|
@@ -841,7 +868,14 @@ gdm_scrollable_widget_slide_to_height (GdmScrollableWidget *scrollable_widget,
|
|
return;
|
|
}
|
|
|
|
- height += gtk_widget_get_style (widget)->ythickness * 2;
|
|
+ context = gtk_widget_get_style_context (widget);
|
|
+ state = gtk_widget_get_state_flags (widget);
|
|
+
|
|
+ gtk_style_context_get_padding (context, state, &padding);
|
|
+ gtk_style_context_get_border (context, state, &border);
|
|
+
|
|
+ height += padding.top + padding.bottom;
|
|
+ height += border.top + border.bottom;
|
|
|
|
gtk_widget_get_allocation (widget, &widget_allocation);
|
|
|
|
--
|
|
1.7.4
|
|
|