From 2dc8e8d0a0a6cca33c80e6e213705c1e6a017596 Mon Sep 17 00:00:00 2001 From: "bryner%netscape.com" Date: Sat, 20 Aug 2005 07:12:37 +0000 Subject: [PATCH] On second thought, only allocate the extra space when determining the element size; still paint the indicator at its "real" size. Not part of the build. --- widget/src/gtk/gtkdrawing.c | 11 ++--------- widget/src/gtk/nsNativeThemeGTK.cpp | 7 ++++++- widget/src/gtk2/nsNativeThemeGTK.cpp | 7 ++++++- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/widget/src/gtk/gtkdrawing.c b/widget/src/gtk/gtkdrawing.c index 4ccff070b304..25a330255b6c 100644 --- a/widget/src/gtk/gtkdrawing.c +++ b/widget/src/gtk/gtkdrawing.c @@ -172,13 +172,6 @@ moz_gtk_checkbox_get_metrics(gint* indicator_size, gint* indicator_spacing) if (indicator_spacing) *indicator_spacing = klass->indicator_spacing; #endif - - /* hack alert: many themes don't correctly report the indicator size, - and have indicators larger than the default 10px indicator_size. - So, leave a little slop room. Too bad there's no way to tell - if the theme has overridden the default indicator size. */ - - *indicator_size = MAX(*indicator_size, 14); } void @@ -194,8 +187,8 @@ moz_gtk_checkbox_paint(GdkWindow* window, GtkStyle* style, moz_gtk_checkbox_get_metrics(&indicator_size, NULL); - /* left justified, vertically centered within the rect */ - x = rect->x; + /* centered within the rect */ + x = rect->x + (rect->width - indicator_size) / 2; y = rect->y + (rect->height - indicator_size) / 2; width = indicator_size; height = indicator_size; diff --git a/widget/src/gtk/nsNativeThemeGTK.cpp b/widget/src/gtk/nsNativeThemeGTK.cpp index 72a4046621cd..3976c4be31dc 100644 --- a/widget/src/gtk/nsNativeThemeGTK.cpp +++ b/widget/src/gtk/nsNativeThemeGTK.cpp @@ -519,7 +519,12 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsIRenderingContext* aContext, gint indicator_size, indicator_spacing; moz_gtk_checkbox_get_metrics(&indicator_size, &indicator_spacing); - aResult->width = aResult->height = indicator_size; + + // Hack alert: several themes have indicators larger than the default + // 10px size, but don't set the indicator size property. So, leave + // a little slop room by making the minimum size 14px. + + aResult->width = aResult->height = MAX(indicator_size, 14); *aIsOverridable = PR_FALSE; } break; diff --git a/widget/src/gtk2/nsNativeThemeGTK.cpp b/widget/src/gtk2/nsNativeThemeGTK.cpp index 72a4046621cd..3976c4be31dc 100644 --- a/widget/src/gtk2/nsNativeThemeGTK.cpp +++ b/widget/src/gtk2/nsNativeThemeGTK.cpp @@ -519,7 +519,12 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsIRenderingContext* aContext, gint indicator_size, indicator_spacing; moz_gtk_checkbox_get_metrics(&indicator_size, &indicator_spacing); - aResult->width = aResult->height = indicator_size; + + // Hack alert: several themes have indicators larger than the default + // 10px size, but don't set the indicator size property. So, leave + // a little slop room by making the minimum size 14px. + + aResult->width = aResult->height = MAX(indicator_size, 14); *aIsOverridable = PR_FALSE; } break;