Re: Patch: remove hard-coded indicator size (revised)



"Daniel Richard G." <straker@fox.mit.edu> writes:

> Patch submitted for inclusion into GTK+ CVS:
> 
> This patch allows the default size of check/radio indicators in menu items
> to be modified via Gtk{Check,Radio}MenuItemClass, following the same
> convention for modifying the size of Gtk{Check,Radio}Button indicators.
> 
> Currently, these are hard-coded (bad!) to 8x8 size. I am writing a theme
> engine which requires them to be 12x12. This patch gives theme engines this
> flexibility, while taking care to retain a default size of 8x8. 
> 
> This patch supersedes an earlier one I submitted (gtk-skunk-000628-0),  
> which I found to contain some errors. (My workstation setup is such that
> it is difficult to compile the CVS version of GTK+)

Themes are not allowed to modify class variables. Some themes do
that, and worse. We tolerate that, but we aren't going to encourage
that by adding a patch like this.

Figuring out some slightly better way for themes to do things like
this is something that, with any luck at all, we'll manage to do
for GTK+-2.0. If we do that, geometry parameters like this will
be one of the things that themes will be able to configure.

Regards,
                                        Owen

> //=================// //////  ////// //==================================\\
>  Straker Skunk     / //////  ////// /      Skunks are such wonderful
>  <skunk@mit.edu>  / //////  ////// /     creatures... soft, and cuddly,
>  -- -- -- -- -- --\ \\\\\\  \\\\\\ \      and if you annoy them they
>  Daniel Richard G. \ \\\\\\  \\\\\\ \      make you stink like hell
>  ========--====--==-\ \\\\\\  \\\\\\ \---------------=--==--====--========
>  //mit.edu/straker  / //////  ////// / Furry|Course VI-3|MIT Class of 2001
>  //skunk.mit.edu   / //////  ////// / 80% Beaver 90% Penguin 100% SKUNK!!!
> \\===============// //////  ////// //====================================//
>                      ''//    ''//
> Index: gtk/gtkcheckmenuitem.c
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gtk/gtkcheckmenuitem.c,v
> retrieving revision 1.21
> diff -u -r1.21 gtkcheckmenuitem.c
> --- gtk/gtkcheckmenuitem.c	2000/06/20 21:04:31	1.21
> +++ gtk/gtkcheckmenuitem.c	2000/07/07 03:37:43
> @@ -98,6 +98,7 @@
>    menu_item_class->toggle_size = 12;
>    menu_item_class->hide_on_activate = FALSE;
>    
> +  klass->indicator_size = 8;
>    klass->toggled = NULL;
>    klass->draw_indicator = gtk_real_check_menu_item_draw_indicator;
>  
> @@ -244,8 +245,8 @@
>      {
>        widget = GTK_WIDGET (check_menu_item);
>  
> -      width = 8;
> -      height = 8;
> +      width = GTK_CHECK_MENU_ITEM_CLASS (GTK_OBJECT (check_menu_item)->klass)->indicator_size;
> +      height = width;
>        x = (GTK_CONTAINER (check_menu_item)->border_width +
>  	   widget->style->xthickness + 2);
>        y = (widget->allocation.height - height) / 2;
> Index: gtk/gtkcheckmenuitem.h
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gtk/gtkcheckmenuitem.h,v
> retrieving revision 1.8
> diff -u -r1.8 gtkcheckmenuitem.h
> --- gtk/gtkcheckmenuitem.h	2000/02/13 08:16:47	1.8
> +++ gtk/gtkcheckmenuitem.h	2000/07/07 03:37:43
> @@ -59,6 +59,8 @@
>  struct _GtkCheckMenuItemClass
>  {
>    GtkMenuItemClass parent_class;
> +
> +  guint16 indicator_size;
>    
>    void (* toggled)	  (GtkCheckMenuItem *check_menu_item);
>    void (* draw_indicator) (GtkCheckMenuItem *check_menu_item,
> Index: gtk/gtkradiomenuitem.c
> ===================================================================
> RCS file: /cvs/gnome/gtk+/gtk/gtkradiomenuitem.c,v
> retrieving revision 1.16
> diff -u -r1.16 gtkradiomenuitem.c
> --- gtk/gtkradiomenuitem.c	2000/06/20 21:04:38	1.16
> +++ gtk/gtkradiomenuitem.c	2000/07/07 03:37:43
> @@ -281,8 +281,8 @@
>      {
>        widget = GTK_WIDGET (check_menu_item);
>  
> -      width = 8;
> -      height = 8;
> +      width = GTK_CHECK_MENU_ITEM_CLASS (GTK_OBJECT (check_menu_item)->klass)->indicator_size;
> +      height = width;
>        x = (GTK_CONTAINER (check_menu_item)->border_width +
>  	   widget->style->xthickness + 2);
>        y = (widget->allocation.height - height) / 2;




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]