Commit 8243e3d4 authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer

gdk/gdkdisplay.h gdk/gdkdrawable.h gdk/gdkevents.h gdk/gdkpango.h

2008-01-15  Michael Natterer  <mitch@imendio.com>

	* gdk/gdkdisplay.h
	* gdk/gdkdrawable.h
	* gdk/gdkevents.h
	* gdk/gdkpango.h
	* gdk/gdkregion.h
	* gdk/gdkrgb.h
	* gdk/gdkwindow.h: made more struct pointer and array parameters
	const. GDK should now be constified as far as possible without
	breaking source compatibility. Includes some minor cleanup like
	indentation and s/nfoo/n_foo/ (bug #508544).

	* gdk/gdkdisplay.c
	* gdk/gdkdraw.c
	* gdk/gdkevents.c
	* gdk/gdkpango.c
	* gdk/gdkregion-generic.c
	* gdk/gdkrgb.c
	* gdk/directfb/gdkdisplay-directfb.c
	* gdk/directfb/gdkwindow-directfb.c
	* gdk/quartz/gdkdisplay-quartz.c
	* gdk/quartz/gdkwindow-quartz.c
	* gdk/win32/gdkdisplay-win32.c
	* gdk/win32/gdkwindow-win32.c
	* gdk/x11/gdkdisplay-x11.c
	* gdk/x11/gdkwindow-x11.c: changed accordingly.


svn path=/trunk/; revision=19372
parent 7a658c13
2008-01-15 Michael Natterer <mitch@imendio.com>
* gdk/gdkdisplay.h
* gdk/gdkdrawable.h
* gdk/gdkevents.h
* gdk/gdkpango.h
* gdk/gdkregion.h
* gdk/gdkrgb.h
* gdk/gdkwindow.h: made more struct pointer and array parameters
const. GDK should now be constified as far as possible without
breaking source compatibility. Includes some minor cleanup like
indentation and s/nfoo/n_foo/ (bug #508544).
* gdk/gdkdisplay.c
* gdk/gdkdraw.c
* gdk/gdkevents.c
* gdk/gdkpango.c
* gdk/gdkregion-generic.c
* gdk/gdkrgb.c
* gdk/directfb/gdkdisplay-directfb.c
* gdk/directfb/gdkwindow-directfb.c
* gdk/quartz/gdkdisplay-quartz.c
* gdk/quartz/gdkwindow-quartz.c
* gdk/win32/gdkdisplay-win32.c
* gdk/win32/gdkwindow-win32.c
* gdk/x11/gdkdisplay-x11.c
* gdk/x11/gdkwindow-x11.c: changed accordingly.
2008-01-14 Michael Natterer <mitch@imendio.com>
* gtk/gtkrc.c (_gtk_rc_style_unset_rc_property): add cast to fix
......@@ -40,7 +68,7 @@
* gdk/gdkinternals.h
* gdk/gdkregion.h
* gdk/gdkwindow.h: made GdkRectangle*, GdkRegion* and GdkColor*
parameters const.
parameters const (bug #508544).
* gdk/gdkcairo.c
* gdk/gdkgc.c
......
......@@ -250,11 +250,11 @@ gdk_display_supports_clipboard_persistence (GdkDisplay *display)
}
void
gdk_display_store_clipboard (GdkDisplay *display,
GdkWindow *clipboard_window,
guint32 time_,
GdkAtom *targets,
gint n_targets)
gdk_display_store_clipboard (GdkDisplay *display,
GdkWindow *clipboard_window,
guint32 time_,
const GdkAtom *targets,
gint n_targets)
{
g_warning("gdk_display_store_clipboard Unimplemented function \n");
......
......@@ -1707,9 +1707,9 @@ gdk_window_set_hints (GdkWindow *window,
}
void
gdk_window_set_geometry_hints (GdkWindow *window,
GdkGeometry *geometry,
GdkWindowHints geom_mask)
gdk_window_set_geometry_hints (GdkWindow *window,
const GdkGeometry *geometry,
GdkWindowHints geom_mask)
{
g_return_if_fail (GDK_IS_WINDOW (window));
......
......@@ -251,8 +251,8 @@ gdk_display_peek_event (GdkDisplay *display)
* Since: 2.2
**/
void
gdk_display_put_event (GdkDisplay *display,
GdkEvent *event)
gdk_display_put_event (GdkDisplay *display,
const GdkEvent *event)
{
g_return_if_fail (GDK_IS_DISPLAY (display));
g_return_if_fail (event != NULL);
......
......@@ -122,10 +122,10 @@ void gdk_display_close (GdkDisplay *display);
GList * gdk_display_list_devices (GdkDisplay *display);
GdkEvent* gdk_display_get_event (GdkDisplay *display);
GdkEvent* gdk_display_peek_event (GdkDisplay *display);
void gdk_display_put_event (GdkDisplay *display,
GdkEvent *event);
GdkEvent* gdk_display_get_event (GdkDisplay *display);
GdkEvent* gdk_display_peek_event (GdkDisplay *display);
void gdk_display_put_event (GdkDisplay *display,
const GdkEvent *event);
void gdk_display_add_client_message_filter (GdkDisplay *display,
GdkAtom message_type,
......@@ -172,12 +172,12 @@ gboolean gdk_display_supports_selection_notification (GdkDisplay *display);
gboolean gdk_display_request_selection_notification (GdkDisplay *display,
GdkAtom selection);
gboolean gdk_display_supports_clipboard_persistence (GdkDisplay *display);
void gdk_display_store_clipboard (GdkDisplay *display,
GdkWindow *clipboard_window,
guint32 time_,
GdkAtom *targets,
gint n_targets);
gboolean gdk_display_supports_clipboard_persistence (GdkDisplay *display);
void gdk_display_store_clipboard (GdkDisplay *display,
GdkWindow *clipboard_window,
guint32 time_,
const GdkAtom *targets,
gint n_targets);
gboolean gdk_display_supports_shapes (GdkDisplay *display);
gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
......
......@@ -467,22 +467,23 @@ gdk_draw_arc (GdkDrawable *drawable,
* necessary.
* @points: an array of #GdkPoint structures specifying the points making
* up the polygon.
* @npoints: the number of points.
* @n_points: the number of points.
*
* Draws an outlined or filled polygon.
**/
void
gdk_draw_polygon (GdkDrawable *drawable,
GdkGC *gc,
gboolean filled,
GdkPoint *points,
gint npoints)
gdk_draw_polygon (GdkDrawable *drawable,
GdkGC *gc,
gboolean filled,
const GdkPoint *points,
gint n_points)
{
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (GDK_IS_GC (gc));
GDK_DRAWABLE_GET_CLASS (drawable)->draw_polygon (drawable, gc, filled,
points, npoints);
(GdkPoint *) points,
n_points);
}
/* gdk_draw_string
......@@ -741,17 +742,17 @@ gdk_draw_image (GdkDrawable *drawable,
**/
void
gdk_draw_pixbuf (GdkDrawable *drawable,
GdkGC *gc,
GdkPixbuf *pixbuf,
gint src_x,
gint src_y,
gint dest_x,
gint dest_y,
gint width,
gint height,
GdkRgbDither dither,
gint x_dither,
gint y_dither)
GdkGC *gc,
const GdkPixbuf *pixbuf,
gint src_x,
gint src_y,
gint dest_x,
gint dest_y,
gint width,
gint height,
GdkRgbDither dither,
gint x_dither,
gint y_dither)
{
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (gc == NULL || GDK_IS_GC (gc));
......@@ -765,7 +766,8 @@ gdk_draw_pixbuf (GdkDrawable *drawable,
if (height == -1)
height = gdk_pixbuf_get_height (pixbuf);
GDK_DRAWABLE_GET_CLASS (drawable)->draw_pixbuf (drawable, gc, pixbuf,
GDK_DRAWABLE_GET_CLASS (drawable)->draw_pixbuf (drawable, gc,
(GdkPixbuf *) pixbuf,
src_x, src_y, dest_x, dest_y,
width, height,
dither, x_dither, y_dither);
......@@ -776,26 +778,27 @@ gdk_draw_pixbuf (GdkDrawable *drawable,
* @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
* @gc: a #GdkGC.
* @points: an array of #GdkPoint structures.
* @npoints: the number of points to be drawn.
* @n_points: the number of points to be drawn.
*
* Draws a number of points, using the foreground color and other
* attributes of the #GdkGC.
**/
void
gdk_draw_points (GdkDrawable *drawable,
GdkGC *gc,
GdkPoint *points,
gint npoints)
gdk_draw_points (GdkDrawable *drawable,
GdkGC *gc,
const GdkPoint *points,
gint n_points)
{
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail ((points != NULL) && (npoints > 0));
g_return_if_fail ((points != NULL) && (n_points > 0));
g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (npoints >= 0);
g_return_if_fail (n_points >= 0);
if (npoints == 0)
if (n_points == 0)
return;
GDK_DRAWABLE_GET_CLASS (drawable)->draw_points (drawable, gc, points, npoints);
GDK_DRAWABLE_GET_CLASS (drawable)->draw_points (drawable, gc,
(GdkPoint *) points, n_points);
}
/**
......@@ -804,27 +807,28 @@ gdk_draw_points (GdkDrawable *drawable,
* @gc: a #GdkGC.
* @segs: an array of #GdkSegment structures specifying the start and
* end points of the lines to be drawn.
* @nsegs: the number of line segments to draw, i.e. the size of the
* @n_segs: the number of line segments to draw, i.e. the size of the
* @segs array.
*
* Draws a number of unconnected lines.
**/
void
gdk_draw_segments (GdkDrawable *drawable,
GdkGC *gc,
GdkSegment *segs,
gint nsegs)
gdk_draw_segments (GdkDrawable *drawable,
GdkGC *gc,
const GdkSegment *segs,
gint n_segs)
{
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
if (nsegs == 0)
if (n_segs == 0)
return;
g_return_if_fail (segs != NULL);
g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (nsegs >= 0);
g_return_if_fail (n_segs >= 0);
GDK_DRAWABLE_GET_CLASS (drawable)->draw_segments (drawable, gc, segs, nsegs);
GDK_DRAWABLE_GET_CLASS (drawable)->draw_segments (drawable, gc,
(GdkSegment *) segs, n_segs);
}
/**
......@@ -832,7 +836,7 @@ gdk_draw_segments (GdkDrawable *drawable,
* @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
* @gc: a #GdkGC.
* @points: an array of #GdkPoint structures specifying the endpoints of the
* @npoints: the size of the @points array.
* @n_points: the size of the @points array.
*
* Draws a series of lines connecting the given points.
* The way in which joins between lines are draw is determined by the
......@@ -840,30 +844,31 @@ gdk_draw_segments (GdkDrawable *drawable,
* gdk_gc_set_line_attributes().
**/
void
gdk_draw_lines (GdkDrawable *drawable,
GdkGC *gc,
GdkPoint *points,
gint npoints)
gdk_draw_lines (GdkDrawable *drawable,
GdkGC *gc,
const GdkPoint *points,
gint n_points)
{
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (points != NULL);
g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (npoints >= 0);
g_return_if_fail (n_points >= 0);
if (npoints == 0)
if (n_points == 0)
return;
GDK_DRAWABLE_GET_CLASS (drawable)->draw_lines (drawable, gc, points, npoints);
GDK_DRAWABLE_GET_CLASS (drawable)->draw_lines (drawable, gc,
(GdkPoint *) points, n_points);
}
static void
real_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
PangoMatrix *matrix,
PangoFont *font,
gdouble x,
gdouble y,
PangoGlyphString *glyphs)
real_draw_glyphs (GdkDrawable *drawable,
GdkGC *gc,
const PangoMatrix *matrix,
PangoFont *font,
gdouble x,
gdouble y,
PangoGlyphString *glyphs)
{
cairo_t *cr;
......@@ -948,13 +953,13 @@ gdk_draw_glyphs (GdkDrawable *drawable,
* Since: 2.6
**/
void
gdk_draw_glyphs_transformed (GdkDrawable *drawable,
GdkGC *gc,
PangoMatrix *matrix,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs)
gdk_draw_glyphs_transformed (GdkDrawable *drawable,
GdkGC *gc,
const PangoMatrix *matrix,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs)
{
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (GDK_IS_GC (gc));
......@@ -979,10 +984,10 @@ gdk_draw_glyphs_transformed (GdkDrawable *drawable,
* Since: 2.6
**/
void
gdk_draw_trapezoids (GdkDrawable *drawable,
GdkGC *gc,
GdkTrapezoid *trapezoids,
gint n_trapezoids)
gdk_draw_trapezoids (GdkDrawable *drawable,
GdkGC *gc,
const GdkTrapezoid *trapezoids,
gint n_trapezoids)
{
cairo_t *cr;
int i;
......
......@@ -109,7 +109,7 @@ struct _GdkDrawableClass
GdkGC *gc,
GdkSegment *segs,
gint nsegs);
void (*draw_lines) (GdkDrawable *drawable,
void (*draw_lines) (GdkDrawable *drawable,
GdkGC *gc,
GdkPoint *points,
gint npoints);
......@@ -276,8 +276,8 @@ void gdk_draw_arc (GdkDrawable *drawable,
void gdk_draw_polygon (GdkDrawable *drawable,
GdkGC *gc,
gboolean filled,
GdkPoint *points,
gint npoints);
const GdkPoint *points,
gint n_points);
#if !defined (GDK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION)
/* Used by gtk_default_draw_string () */
void gdk_draw_string (GdkDrawable *drawable,
......@@ -325,19 +325,19 @@ void gdk_draw_image (GdkDrawable *drawable,
gint height);
void gdk_draw_points (GdkDrawable *drawable,
GdkGC *gc,
GdkPoint *points,
gint npoints);
const GdkPoint *points,
gint n_points);
void gdk_draw_segments (GdkDrawable *drawable,
GdkGC *gc,
GdkSegment *segs,
gint nsegs);
const GdkSegment *segs,
gint n_segs);
void gdk_draw_lines (GdkDrawable *drawable,
GdkGC *gc,
GdkPoint *points,
gint npoints);
const GdkPoint *points,
gint n_points);
void gdk_draw_pixbuf (GdkDrawable *drawable,
GdkGC *gc,
GdkPixbuf *pixbuf,
const GdkPixbuf *pixbuf,
gint src_x,
gint src_y,
gint dest_x,
......@@ -380,17 +380,17 @@ void gdk_draw_layout_with_colors (GdkDrawable *drawable,
const GdkColor *foreground,
const GdkColor *background);
void gdk_draw_glyphs_transformed (GdkDrawable *drawable,
GdkGC *gc,
PangoMatrix *matrix,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs);
void gdk_draw_trapezoids (GdkDrawable *drawable,
GdkGC *gc,
GdkTrapezoid *trapezoids,
gint n_trapezoids);
void gdk_draw_glyphs_transformed (GdkDrawable *drawable,
GdkGC *gc,
const PangoMatrix *matrix,
PangoFont *font,
gint x,
gint y,
PangoGlyphString *glyphs);
void gdk_draw_trapezoids (GdkDrawable *drawable,
GdkGC *gc,
const GdkTrapezoid *trapezoids,
gint n_trapezoids);
#ifndef GDK_DISABLE_DEPRECATED
#define gdk_draw_pixmap gdk_draw_drawable
......
......@@ -237,7 +237,7 @@ gdk_event_peek (void)
* queue if event->any.window is %NULL. See gdk_display_put_event().
**/
void
gdk_event_put (GdkEvent *event)
gdk_event_put (const GdkEvent *event)
{
GdkDisplay *display;
......@@ -332,7 +332,7 @@ gdk_event_new (GdkEventType type)
}
static gboolean
gdk_event_is_allocated (GdkEvent *event)
gdk_event_is_allocated (const GdkEvent *event)
{
if (event_hash)
return g_hash_table_lookup (event_hash, event) != NULL;
......@@ -351,7 +351,7 @@ gdk_event_is_allocated (GdkEvent *event)
* gdk_event_free().
**/
GdkEvent*
gdk_event_copy (GdkEvent *event)
gdk_event_copy (const GdkEvent *event)
{
GdkEventPrivate *new_private;
GdkEvent *new_event;
......@@ -499,7 +499,7 @@ gdk_event_free (GdkEvent *event)
* Return value: time stamp field from @event
**/
guint32
gdk_event_get_time (GdkEvent *event)
gdk_event_get_time (const GdkEvent *event)
{
if (event)
switch (event->type)
......@@ -570,8 +570,8 @@ gdk_event_get_time (GdkEvent *event)
* Return value: %TRUE if there was a state field in the event
**/
gboolean
gdk_event_get_state (GdkEvent *event,
GdkModifierType *state)
gdk_event_get_state (const GdkEvent *event,
GdkModifierType *state)
{
g_return_val_if_fail (state != NULL, FALSE);
......@@ -646,9 +646,9 @@ gdk_event_get_state (GdkEvent *event,
* Return value: %TRUE if the event delivered event window coordinates
**/
gboolean
gdk_event_get_coords (GdkEvent *event,
gdouble *x_win,
gdouble *y_win)
gdk_event_get_coords (const GdkEvent *event,
gdouble *x_win,
gdouble *y_win)
{
gdouble x = 0, y = 0;
gboolean fetched = TRUE;
......@@ -705,9 +705,9 @@ gdk_event_get_coords (GdkEvent *event,
* Return value: %TRUE if the event delivered root window coordinates
**/
gboolean
gdk_event_get_root_coords (GdkEvent *event,
gdouble *x_root,
gdouble *y_root)
gdk_event_get_root_coords (const GdkEvent *event,
gdouble *x_root,
gdouble *y_root)
{
gdouble x = 0, y = 0;
gboolean fetched = TRUE;
......@@ -770,9 +770,9 @@ gdk_event_get_root_coords (GdkEvent *event,
* Return value: %TRUE if the specified axis was found, otherwise %FALSE
**/
gboolean
gdk_event_get_axis (GdkEvent *event,
GdkAxisUse axis_use,
gdouble *value)
gdk_event_get_axis (const GdkEvent *event,
GdkAxisUse axis_use,
gdouble *value)
{
gdouble *axes;
GdkDevice *device;
......@@ -856,7 +856,7 @@ gdk_event_get_axis (GdkEvent *event,
* Since: 2.12
**/
void
gdk_event_request_motions (GdkEventMotion *event)
gdk_event_request_motions (const GdkEventMotion *event)
{
g_return_if_fail (event != NULL);
if (event->type == GDK_MOTION_NOTIFY && event->is_hint)
......@@ -904,7 +904,7 @@ gdk_event_set_screen (GdkEvent *event,
* Since: 2.2
**/
GdkScreen *
gdk_event_get_screen (GdkEvent *event)
gdk_event_get_screen (const GdkEvent *event)
{
if (gdk_event_is_allocated (event))
{
......
......@@ -511,32 +511,32 @@ GdkEvent* gdk_event_get (void);
GdkEvent* gdk_event_peek (void);
GdkEvent* gdk_event_get_graphics_expose (GdkWindow *window);
void gdk_event_put (GdkEvent *event);
void gdk_event_put (const GdkEvent *event);
GdkEvent* gdk_event_new (GdkEventType type);
GdkEvent* gdk_event_copy (GdkEvent *event);
GdkEvent* gdk_event_copy (const GdkEvent *event);
void gdk_event_free (GdkEvent *event);
guint32 gdk_event_get_time (GdkEvent *event);
gboolean gdk_event_get_state (GdkEvent *event,
guint32 gdk_event_get_time (const GdkEvent *event);
gboolean gdk_event_get_state (const GdkEvent *event,
GdkModifierType *state);
gboolean gdk_event_get_coords (GdkEvent *event,
gboolean gdk_event_get_coords (const GdkEvent *event,
gdouble *x_win,
gdouble *y_win);
gboolean gdk_event_get_root_coords (GdkEvent *event,
gboolean gdk_event_get_root_coords (const GdkEvent *event,
gdouble *x_root,
gdouble *y_root);
gboolean gdk_event_get_axis (GdkEvent *event,
gboolean gdk_event_get_axis (const GdkEvent *event,
GdkAxisUse axis_use,
gdouble *value);
void gdk_event_request_motions (GdkEventMotion *event);
void gdk_event_request_motions (const GdkEventMotion *event);
void gdk_event_handler_set (GdkEventFunc func,
gpointer data,
GDestroyNotify notify);
void gdk_event_set_screen (GdkEvent *event,
GdkScreen *screen);
GdkScreen *gdk_event_get_screen (GdkEvent *event);
void gdk_event_set_screen (GdkEvent *event,
GdkScreen *screen);
GdkScreen *gdk_event_get_screen (const GdkEvent *event);
void gdk_set_show_events (gboolean show_events);
gboolean gdk_get_show_events (void);
......
......@@ -1214,7 +1214,7 @@ static GdkRegion*
layout_iter_get_line_clip_region (PangoLayoutIter *iter,
gint x_origin,
gint y_origin,
gint *index_ranges,
const gint *index_ranges,
gint n_ranges)
{
PangoLayoutLine *line;
......@@ -1297,7 +1297,7 @@ GdkRegion*
gdk_pango_layout_line_get_clip_region (PangoLayoutLine *line,
gint x_origin,
gint y_origin,
gint *index_ranges,
const gint *index_ranges,
gint n_ranges)
{
GdkRegion *clip_region;
......@@ -1341,7 +1341,7 @@ GdkRegion*
gdk_pango_layout_get_clip_region (PangoLayout *layout,
gint x_origin,
gint y_origin,
gint *index_ranges,
const gint *index_ranges,
gint n_ranges)
{
PangoLayoutIter *iter;
......
......@@ -119,12 +119,12 @@ void gdk_pango_context_set_colormap (PangoContext *context,
GdkRegion *gdk_pango_layout_line_get_clip_region (PangoLayoutLine *line,
gint x_origin,
gint y_origin,
gint *index_ranges,
const gint *index_ranges,
gint n_ranges);
GdkRegion *gdk_pango_layout_get_clip_region (PangoLayout *layout,
gint x_origin,
gint y_origin,
gint *index_ranges,
const gint *index_ranges,
gint n_ranges);
......
......@@ -1689,17 +1689,16 @@ gdk_region_rect_in (const GdkRegion *region,
static void
gdk_region_unsorted_spans_intersect_foreach (GdkRegion *region,
GdkSpan *spans,
int n_spans,
GdkSpanFunc function,
gpointer data)
gdk_region_unsorted_spans_intersect_foreach (GdkRegion *region,
const GdkSpan *spans,
int n_spans,
GdkSpanFunc function,
gpointer data)
{
gint i, left, right, y;
gint clipped_left, clipped_right;
GdkRegionBox *pbox;
GdkRegionBox *pboxEnd;
GdkSpan out_span;
if (!region->numRects)
return;
......@@ -1729,6 +1728,8 @@ gdk_region_unsorted_spans_intersect_foreach (GdkRegion *region,
if ((right > pbox->x1) && (left < pbox->x2))
{
GdkSpan out_span;
clipped_left = MAX (left, pbox->x1);
clipped_right = MIN (right, pbox->x2);
......@@ -1753,20 +1754,19 @@ gdk_region_unsorted_spans_intersect_foreach (GdkRegion *region,
* Calls a function on each span in the intersection of @region and @spans.
*/
void
gdk_region_spans_intersect_foreach (GdkRegion *region,
GdkSpan *spans,
int n_spans,