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 439725 - Style::paint_*() function's don't accept NULL rectangles for area parameter
Style::paint_*() function's don't accept NULL rectangles for area parameter
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal minor
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2007-05-19 16:41 UTC by Stef Walter
Modified: 2011-02-09 17:12 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Stef Walter 2007-05-19 16:41:57 UTC
The various gtk_paint_* functions accept NULL for the 'area' parameter, which denotes 'no clipping'. There is no way in the gtkmm Style::paint_* equivalents to specify this NULL area paramater. 

A solution might be: If a Gdk::Rectangcle is that has_zero_area() it could be converted to NULL before being passed down to the gtk_paint_* functions.
Comment 1 Murray Cumming 2007-05-23 15:53:21 UTC
Well spotted. Usually we would just add a method overload that doesn't have that parameter. Could you provide a patch for that, please.

Try to adjust the doxygen documentation appropriately too, please, or tell me if you need me to do that.
Comment 2 Jonathon Jongsma 2007-10-23 02:07:30 UTC
This becomes a bit complicated to do overloads because some of these functions actually have about 3 parameters that can be NULL.  To cover all of those cases with overloaded functions would require ... 8 different overloads for each of those functions (?).  As an example, look at gtk_paint_arrow -- area, widget, and detail can all be NULL:

void gtk_paint_arrow (GtkStyle * style,
		      GdkWindow * window,
		      GtkStateType state_type,
		      GtkShadowType shadow_type,
		      GdkRectangle * area,
		      GtkWidget * widget,
		      const gchar * detail,
		      GtkArrowType arrow_type,
		      gboolean fill, gint x, gint y, gint width, gint height);

Draws an arrow in the given rectangle on window using the given parameters. arrow_type determines the direction of the arrow.

style : a GtkStyle
window : a GdkWindow
state_type : a state
shadow_type : the type of shadow to draw
area : clip rectangle, or NULL if the output should not be clipped
widget : the widget (may be NULL)
detail : a style detail (may be NULL)
arrow_type : the type of arrow to draw
fill : TRUE if the arrow tip should be filled
x : x origin of the rectangle to draw the arrow in
y : y origin of the rectangle to draw the arrow in
width : width of the rectangle to draw the arrow in
height : height of the rectangle to draw the arrow in
Comment 3 Murray Cumming 2007-11-05 11:33:21 UTC
The detail parameter is a string so we could use an empty string (and that might work already, depending on whether the C function interprets "" the same as NULL" But that still leaves 2 optional parameters, leading to 3 method overloads. I'd rather avoid that if possible.

I wonder about the meaning of NULL for the widget and detail parameters. Maybe knowing that would help us to choose what to do.
Comment 4 Johannes Schmid 2009-10-28 15:27:38 UTC
Just for reference: It is very difficult to say what the widget and the detail parameter say. The default implementation (gtk_default_draw_arrow) doesn't use any of them but it's up to the engine programmer to use them if he wants to.

=> Clearlooks uses the widget parameter (it checks if the widget is disabled) but doesn't use details for example.
Comment 5 Murray Cumming 2011-02-08 09:12:46 UTC
gtk_paint_arrow()
  http://library.gnome.org/devel/gtk/unstable/GtkStyle.html#gtk-paint-arrow
has been deprecated in favour of gtk_render_arrow(),
  http://library.gnome.org/devel/gtk/unstable/GtkStyleContext.html#gtk-render-arrow
which does not have that detail parameter, so I guess we can forget about that issue.

It doesn't have the area parameter either, or any other parameters that can be NULL. So I guess we can close this whole bug as fixed in gtkmm 3. Please reopen if I am wrong.
Comment 6 Stef Walter 2011-02-09 17:12:45 UTC
Makes sense.