From 9cbf37990b543d07a63971b6a3b9d02b3ded7046 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 27 Feb 2002 22:41:33 +0000 Subject: [PATCH] if CAN_FOCUS reserve focus_line_width + focus_line_pad extra space and Wed Feb 27 17:32:09 2002 Owen Taylor * gtk/gtkrange.c (gtk_range_get_props): if CAN_FOCUS reserve focus_line_width + focus_line_pad extra space and draw the focus in that space. #72027. --- ChangeLog | 6 ++++++ ChangeLog.pre-2-0 | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-2 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ gtk/gtkrange.c | 33 ++++++++++++++++++++++++++++----- 8 files changed, 70 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index a7337d7324..39600da79b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Feb 27 17:32:09 2002 Owen Taylor + + * gtk/gtkrange.c (gtk_range_get_props): if CAN_FOCUS + reserve focus_line_width + focus_line_pad extra + space and draw the focus in that space. #72027. + Wed Feb 27 23:02:55 2002 Soeren Sandmann * gtk/gtkhandlebox.c (gtk_handle_box_realize): minor code cleanup diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index a7337d7324..39600da79b 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,9 @@ +Wed Feb 27 17:32:09 2002 Owen Taylor + + * gtk/gtkrange.c (gtk_range_get_props): if CAN_FOCUS + reserve focus_line_width + focus_line_pad extra + space and draw the focus in that space. #72027. + Wed Feb 27 23:02:55 2002 Soeren Sandmann * gtk/gtkhandlebox.c (gtk_handle_box_realize): minor code cleanup diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a7337d7324..39600da79b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +Wed Feb 27 17:32:09 2002 Owen Taylor + + * gtk/gtkrange.c (gtk_range_get_props): if CAN_FOCUS + reserve focus_line_width + focus_line_pad extra + space and draw the focus in that space. #72027. + Wed Feb 27 23:02:55 2002 Soeren Sandmann * gtk/gtkhandlebox.c (gtk_handle_box_realize): minor code cleanup diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index a7337d7324..39600da79b 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,9 @@ +Wed Feb 27 17:32:09 2002 Owen Taylor + + * gtk/gtkrange.c (gtk_range_get_props): if CAN_FOCUS + reserve focus_line_width + focus_line_pad extra + space and draw the focus in that space. #72027. + Wed Feb 27 23:02:55 2002 Soeren Sandmann * gtk/gtkhandlebox.c (gtk_handle_box_realize): minor code cleanup diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index a7337d7324..39600da79b 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +Wed Feb 27 17:32:09 2002 Owen Taylor + + * gtk/gtkrange.c (gtk_range_get_props): if CAN_FOCUS + reserve focus_line_width + focus_line_pad extra + space and draw the focus in that space. #72027. + Wed Feb 27 23:02:55 2002 Soeren Sandmann * gtk/gtkhandlebox.c (gtk_handle_box_realize): minor code cleanup diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a7337d7324..39600da79b 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +Wed Feb 27 17:32:09 2002 Owen Taylor + + * gtk/gtkrange.c (gtk_range_get_props): if CAN_FOCUS + reserve focus_line_width + focus_line_pad extra + space and draw the focus in that space. #72027. + Wed Feb 27 23:02:55 2002 Soeren Sandmann * gtk/gtkhandlebox.c (gtk_handle_box_realize): minor code cleanup diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a7337d7324..39600da79b 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +Wed Feb 27 17:32:09 2002 Owen Taylor + + * gtk/gtkrange.c (gtk_range_get_props): if CAN_FOCUS + reserve focus_line_width + focus_line_pad extra + space and draw the focus in that space. #72027. + Wed Feb 27 23:02:55 2002 Soeren Sandmann * gtk/gtkhandlebox.c (gtk_handle_box_realize): minor code cleanup diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index 9cb0998d57..e6d2166802 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -927,9 +927,19 @@ gtk_range_expose (GtkWidget *widget, GtkStateType state; GdkRectangle expose_area; /* Relative to widget->allocation */ GdkRectangle area; + gint focus_line_width = 0; + gint focus_padding = 0; range = GTK_RANGE (widget); + if (GTK_WIDGET_CAN_FOCUS (range)) + { + gtk_widget_style_get (GTK_WIDGET (range), + "focus-line-width", &focus_line_width, + "focus-padding", &focus_padding, + NULL); + } + expose_area = event->area; expose_area.x -= widget->allocation.x; expose_area.y -= widget->allocation.y; @@ -956,10 +966,10 @@ gtk_range_expose (GtkWidget *widget, sensitive ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, &area, GTK_WIDGET(range), "trough", - widget->allocation.x + range->range_rect.x, - widget->allocation.y + range->range_rect.y, - range->range_rect.width, - range->range_rect.height); + widget->allocation.x + range->range_rect.x + focus_line_width + focus_padding, + widget->allocation.y + range->range_rect.y + focus_line_width + focus_padding, + range->range_rect.width - 2 * (focus_line_width + focus_padding), + range->range_rect.height - 2 * (focus_line_width + focus_padding)); if (sensitive && @@ -1630,6 +1640,19 @@ gtk_range_get_props (GtkRange *range, "arrow_displacement_y", &tmp_arrow_displacement_y, NULL); + if (GTK_WIDGET_CAN_FOCUS (range)) + { + gint focus_line_width; + gint focus_padding; + + gtk_widget_style_get (GTK_WIDGET (range), + "focus-line-width", &focus_line_width, + "focus-padding", &focus_padding, + NULL); + + tmp_trough_border += focus_line_width + focus_padding; + } + if (slider_width) *slider_width = tmp_slider_width; @@ -1800,7 +1823,7 @@ gtk_range_calc_request (GtkRange *range, { gint slider_length; gint n_steppers; - + border->left = 0; border->right = 0; border->top = 0;