After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 112647 - Add indicator-size style property for checkmenuitem
Add indicator-size style property for checkmenuitem
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkMenu
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
AP2
Depends on: 131659
Blocks:
 
 
Reported: 2003-05-09 15:06 UTC by bill.haneman
Modified: 2011-02-04 16:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch to add indicator_size property (3.77 KB, patch)
2004-01-16 09:59 UTC, Narayana Pattipati
none Details | Review
too little space (17.97 KB, image/png)
2004-01-30 01:39 UTC, Matthias Clasen
  Details
PNG file showing space between indicator and label (34.62 KB, image/png)
2004-02-10 06:27 UTC, Narayana Pattipati
  Details
PNG showing the space after removing the toggle_check_size hardcoding (37.69 KB, image/png)
2004-02-12 07:16 UTC, Narayana Pattipati
  Details
Patch after replacing hard coded toggle_size with indicator_size property value. (4.25 KB, patch)
2004-02-16 06:49 UTC, Narayana Pattipati
none Details | Review
make the menu items high enough (645 bytes, patch)
2004-02-18 02:01 UTC, Matthias Clasen
none Details | Review

Description bill.haneman 2003-05-09 15:06:37 UTC
Because gtk widgets call gtk_paint_check and gtk_paint_option directly,
passing in a fixed size for the indicator, gtk engines cannot reliably
scale these indicators.  If they do, they have to explicitly override the
size and probably clip mask that they were given, which is unlikely to be
correct in all cases.

Either gtk engines need to do this via gtkstyle (i.e. not passing in the
desired actual checkbox size, but instead passing in the actual available
area for the checkbox, and letting the engine decide how big to make the
indicator) or else gtk+ itself needs to scale the size of the checkboxes
and option buttons, i.e. passing larger checkboxes as the font size gets
bigger (or adding a new gtkstyle param for indicator sizes).

This is a significant accessibility bug.
Comment 1 Soren Sandmann Pedersen 2003-05-09 15:22:16 UTC
Do you mean GtkCheckButton::indicator_size is not good enough?
Comment 2 bill.haneman 2003-05-09 15:51:48 UTC
Soeren: thanks, I had missed this feature since it's not documented in
Gtk-Resource-Files.html at all, and there isn't a GTK_RC_TOKEN type
for it in the docs.

I will try this and see how it works for me, it sounds like the right
fix. :-)
Comment 3 bill.haneman 2003-05-09 15:59:55 UTC
This works well for normal checkbuttons but not in menus.  Is there
something I can change in menus to fix this?

Comment 4 bill.haneman 2003-05-09 16:02:46 UTC
changing bug summary for now.  Remaining issue seems to be menu-specific.
Comment 5 bill.haneman 2003-05-09 16:45:03 UTC
Thanks Owen.  Any reason why this shouldn't just scale with the text
requisition instead?

Comment 6 Calum Benson 2003-08-07 16:12:20 UTC
Apologies for spam... marking as GNOMEVER2.3 so it appears on the official GNOME
bug list :)
Comment 7 Narayana Pattipati 2004-01-12 11:04:09 UTC
The bug can be fixed with the following approach:
Add support to gtkcheckmenuitem.c to handle indicator_size property
and use this property value in drawing the indicator. We need to
follow the gtkcheckbutton indicator_size property code. And later,
change gnome-themes' gtkrc files, to have indicator_size property
value set for GtkCheckMenuItem.

Owen,
Would highly appreciate if you can comment on the above approach.

Although its unlikely that the changes go into next release of gtk+,
it would be ideal if we could solidify the API/ABI of this change. So
that this accessibility stopper can be fixed (locally) and the fix can
later get into the soon-to-be-released version of gtk+.

Thanks.
Comment 8 Narayana Pattipati 2004-01-16 09:49:21 UTC
I have created a patch which adds indicator_size property to
GtkCheckMenuItem. And used that property value in drawing the
indicator. I will upload the patch soon.

Note: The patch has been tested by adding indicator_size property
value for GtkCheckMenuItem in gtkrc files under /usr/share/themes/*.
These changes have to finally go to gnome-themes module. I will create
a new bug against gnome-themes and upload a patch. This patch will
go in once the gtk+ patch is accepted. For example, gtkrc file chnage
will be like:
--- gtkrc.org   Mon Dec 29 15:47:35 2003
+++ gtkrc       Fri Jan 16 15:22:27 2004
@@ -32,6 +32,7 @@ style "default"
   GtkTextView::cursor_color    = "#00cccc"
   GtkEntry::cursor_aspect_ratio = 0.1
   GtkCheckButton::indicator_size = 18
+  GtkCheckMenuItem::indicator_size = 16
   NautilusIconContainer::frame_text = 1
   GtkExpander::expander-size = 24
   GtkExpander::expander-spacing = 8
Comment 9 Narayana Pattipati 2004-01-16 09:59:01 UTC
Created attachment 23434 [details] [review]
proposed patch to add indicator_size property
Comment 10 Narayana Pattipati 2004-01-16 10:17:37 UTC
Raised bug#131659 against gnome-themes to add indicator_size property
in gtkrc files.
Comment 11 Matthias Clasen 2004-01-30 01:37:42 UTC
The patch is a start, but it is incomplete. You also have to ensure
that the menu item allocates enough room to draw the check. See the
attached screenshot for what I'm talking about.
Comment 12 Matthias Clasen 2004-01-30 01:39:32 UTC
Created attachment 23883 [details]
too little space
Comment 13 Narayana Pattipati 2004-02-10 06:24:50 UTC
GtkMenuItem already has "toggle_spacing" property installed. And the
default value for the toggle_spacing is 5. So, after changing this
property value (GtkCheckMenuItem::toggle_spacing) in gtkrc files, I
did not see the problem.

For example, I have seen the above problem with HighContrastLargePrint
theme. The gtkrc file changes I have made for this theme are:

--- HighContrastLargePrint/gtk-2.0/gtkrc.org    Tue Feb 10 11:43:53
2004
+++ HighContrastLargePrint/gtk-2.0/gtkrc        Tue Feb 10 11:27:39
2004
@@ -36,6 +36,8 @@ style "default"
   GtkEntry::cursor_aspect_ratio = 0.1
   EelEditableLabel::cursor_aspect_ratio = 0.1
   GtkCheckButton::indicator_size = 18
+  GtkCheckMenuItem::indicator_size = 18
+  GtkCheckMenuItem::toggle_spacing = 9
   NautilusIconContainer::frame_text = 1
   GtkExpander::expander-size = 24
   GtkExpander::expander-spacing = 8

Please see the attached screenshot after changes to the gtkrc file.

Could you please try adding toggle_spacing parameter value to the
themes' gtkrc files on your system and see if it resolves the problem.
Comment 14 Narayana Pattipati 2004-02-10 06:27:08 UTC
Created attachment 24260 [details]
PNG file showing space between indicator and label
Comment 15 Matthias Clasen 2004-02-10 07:46:42 UTC
No, that is not a solution. The proposed GtkCheckMenuItem::
indicator_size style property must not depend on suitable values of 
other, unrelated style properties. 




How would you document that ?


"If you increaes the size of ::indicator_size, you may also have to 
increase the value of ::toggle_spacing far enough so that the themes 
you care about don't draw overlapping indicators" ?




That doesn't fly.
Comment 16 Narayana Pattipati 2004-02-10 08:50:37 UTC
Matthias,

Thanks for the update.

Can I introduce GtkCheckMenuItem::indicator_spacing style property,
similar to GtkCheckButton::indicator_spacing, to take care of the
checkmenu item spacing ? I think this style property is a related one
to ::indicator_size.

Else, could you please suggest a better way of doing this.
Comment 17 Matthias Clasen 2004-02-10 09:08:43 UTC
What happens if you increase GtkCheckButton::indicator_size without


increasing GtkCheckButton::indicator_spacing ? I think the button 
still allocates enough space to accomodate the larger indicator, and I 
would expect menuitems to behave similarly.
Comment 18 Owen Taylor 2004-02-10 12:48:52 UTC
docs/widget_geometry.txt has a diagram showing exactly how
the various parameters work for GtkCheckButton which may
be a useful reference.
Comment 19 Narayana Pattipati 2004-02-11 14:14:20 UTC
Matthias,

Right, GtkCheckButton is allocating enough space if
GtkCheckButton::indicator_size is increased without increasing the
GtkCheckButton::indicator_spacing. I guess CheckButton is taking care
of this by handling size_request and size_allocate signals to allocate
size based on indicator_size and indicator_spacing.

A default value of 2 is used for GtkCheckButton::indicator_spacing
property, irrespective of indicator_size. If
GtkCheckButton::indicator_spacing is made 0, then there is no space
between indicator and label for themes like Simple, Crux,
HighContrast, HighContrastInverse, HighContrastLargePrint,
HighContrastLargePrintInverse etc.

Should I be doing something similar for GtkCheckMenuItem to handle
size_request and size_allocate, and use the new indicator_size
property in those functions.
Comment 20 Matthias Clasen 2004-02-11 15:34:17 UTC
It might be enough to replace the hardcoded CHECK_TOGGLE_SIZE in


gtk_check_menu_item_toggle_size_request() by the value of the style 


property.
Comment 21 Narayana Pattipati 2004-02-12 07:13:47 UTC
I think it works fine if I replace hard-coded CHECK_TOGGLE_SIZE with
the GtkCheckMenuItem::indicator_size value. I will attach a 
screenshot with this change. Please check if the spacing is fine. If
so, I will upload the revised patch.
Comment 22 Narayana Pattipati 2004-02-12 07:16:21 UTC
Created attachment 24338 [details]
PNG showing the space after removing the toggle_check_size hardcoding
Comment 23 Matthias Clasen 2004-02-14 22:44:08 UTC
Looks good, lets see the patch.
Comment 24 Narayana Pattipati 2004-02-16 06:49:04 UTC
Created attachment 24438 [details] [review]
Patch after replacing hard coded toggle_size with indicator_size property value.
Comment 25 Matthias Clasen 2004-02-18 02:00:05 UTC
Hmm, I still see overlapping indicators if I make the indicator_size
larger than the height of a typical menu item. I need something like
the following patch to make it work (alternatively, one could add a
gtk_check_menu_item_size_request() to enforce that the requested
height is always at least as large as the indicator_size)
Comment 26 Matthias Clasen 2004-02-18 02:01:09 UTC
Created attachment 24503 [details] [review]
make the menu items high enough