GNOME Bugzilla – Bug 439725
Style::paint_*() function's don't accept NULL rectangles for area parameter
Last modified: 2011-02-09 17:12:45 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.
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.
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
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.
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.
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.
Makes sense.