gdk/gdkdraw.c gdk/gdkimage.c gdk/gdkscreen.c replace assertions for obj !=

2008-10-21  Michael Natterer  <mitch@imendio.com>

	* gdk/gdkdraw.c
	* gdk/gdkimage.c
	* gdk/gdkscreen.c
	* gdk/gdkwindow.c: replace assertions for obj != NULL by
	GDK_IS_OBJ(), remove redundant != NULL checks when there is
	already a type check, add some g_return_if_fail() that were
	missing entirely, fix some broken indentation and spacing.


svn path=/trunk/; revision=21695
This commit is contained in:
Michael Natterer 2008-10-21 21:42:39 +00:00 committed by Michael Natterer
parent c103cbec8a
commit 6df89b0ad8
5 changed files with 61 additions and 67 deletions

View File

@ -1,3 +1,13 @@
2008-10-21 Michael Natterer <mitch@imendio.com>
* gdk/gdkdraw.c
* gdk/gdkimage.c
* gdk/gdkscreen.c
* gdk/gdkwindow.c: replace assertions for obj != NULL by
GDK_IS_OBJ(), remove redundant != NULL checks when there is
already a type check, add some g_return_if_fail() that were
missing entirely, fix some broken indentation and spacing.
2008-10-21 Tor Lillqvist <tml@novell.com>
Bug 557266 - Window Management Problem

View File

@ -347,8 +347,6 @@ gdk_draw_line (GdkDrawable *drawable,
{
GdkSegment segment;
g_return_if_fail (drawable != NULL);
g_return_if_fail (gc != NULL);
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (GDK_IS_GC (gc));
@ -630,7 +628,7 @@ gdk_draw_drawable (GdkDrawable *drawable,
gint composite_y_offset = 0;
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (src != NULL);
g_return_if_fail (GDK_IS_DRAWABLE (src));
g_return_if_fail (GDK_IS_GC (gc));
if (width < 0 || height < 0)
@ -693,7 +691,7 @@ gdk_draw_image (GdkDrawable *drawable,
gint height)
{
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (image != NULL);
g_return_if_fail (GDK_IS_IMAGE (image));
g_return_if_fail (GDK_IS_GC (gc));
if (width == -1)
@ -1505,7 +1503,7 @@ gdk_drawable_real_draw_pixbuf (GdkDrawable *drawable,
GdkRegion *clip;
GdkRegion *drect;
GdkRectangle tmp_rect;
g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
g_return_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB);
g_return_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4);

View File

@ -45,7 +45,9 @@
GdkImage *
gdk_image_ref (GdkImage *image)
{
return (GdkImage *) g_object_ref (image);
g_return_val_if_fail (GDK_IS_IMAGE (image), NULL);
return g_object_ref (image);
}
/**
@ -120,7 +122,6 @@ gdk_image_set_colormap (GdkImage *image,
image->colormap = colormap;
g_object_ref (image->colormap);
}
}
/**

View File

@ -152,7 +152,7 @@ gdk_screen_class_init (GdkScreenClass *klass)
static void
gdk_screen_init (GdkScreen *screen)
{
screen->resolution = -1.;
screen->resolution = -1.;
}
static void
@ -308,8 +308,9 @@ gdk_screen_get_monitor_at_window (GdkScreen *screen,
{
gint num_monitors, i, area = 0, screen_num = -1;
GdkRectangle win_rect;
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
gdk_window_get_geometry (window, &win_rect.x, &win_rect.y, &win_rect.width,
&win_rect.height, NULL);
gdk_window_get_origin (window, &win_rect.x, &win_rect.y);
@ -346,7 +347,7 @@ gdk_screen_get_monitor_at_window (GdkScreen *screen,
gint
gdk_screen_width (void)
{
return gdk_screen_get_width (gdk_screen_get_default());
return gdk_screen_get_width (gdk_screen_get_default ());
}
/**
@ -359,7 +360,7 @@ gdk_screen_width (void)
gint
gdk_screen_height (void)
{
return gdk_screen_get_height (gdk_screen_get_default());
return gdk_screen_get_height (gdk_screen_get_default ());
}
/**
@ -374,7 +375,7 @@ gdk_screen_height (void)
gint
gdk_screen_width_mm (void)
{
return gdk_screen_get_width_mm (gdk_screen_get_default());
return gdk_screen_get_width_mm (gdk_screen_get_default ());
}
/**
@ -410,20 +411,20 @@ void
gdk_screen_set_font_options (GdkScreen *screen,
const cairo_font_options_t *options)
{
g_return_if_fail (GDK_IS_SCREEN (screen));
g_return_if_fail (GDK_IS_SCREEN (screen));
if (screen->font_options != options)
{
if (screen->font_options)
cairo_font_options_destroy (screen->font_options);
if (options)
screen->font_options = cairo_font_options_copy (options);
else
screen->font_options = NULL;
g_object_notify (G_OBJECT (screen), "font-options");
}
if (screen->font_options != options)
{
if (screen->font_options)
cairo_font_options_destroy (screen->font_options);
if (options)
screen->font_options = cairo_font_options_copy (options);
else
screen->font_options = NULL;
g_object_notify (G_OBJECT (screen), "font-options");
}
}
/**
@ -440,9 +441,9 @@ gdk_screen_set_font_options (GdkScreen *screen,
const cairo_font_options_t *
gdk_screen_get_font_options (GdkScreen *screen)
{
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
return screen->font_options;
return screen->font_options;
}
/**
@ -462,17 +463,17 @@ void
gdk_screen_set_resolution (GdkScreen *screen,
gdouble dpi)
{
g_return_if_fail (GDK_IS_SCREEN (screen));
g_return_if_fail (GDK_IS_SCREEN (screen));
if (dpi < 0)
dpi = -1.0;
if (dpi < 0)
dpi = -1.0;
if (screen->resolution != dpi)
{
screen->resolution = dpi;
if (screen->resolution != dpi)
{
screen->resolution = dpi;
g_object_notify (G_OBJECT (screen), "resolution");
}
g_object_notify (G_OBJECT (screen), "resolution");
}
}
/**
@ -490,9 +491,9 @@ gdk_screen_set_resolution (GdkScreen *screen,
gdouble
gdk_screen_get_resolution (GdkScreen *screen)
{
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1.);
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1.0);
return screen->resolution;
return screen->resolution;
}
static void

View File

@ -368,7 +368,8 @@ gdk_window_new (GdkWindow *parent,
{
GdkWindow *window;
GdkWindowObject *private, *parent_private;
g_return_val_if_fail (parent == NULL || GDK_IS_WINDOW (parent), NULL);
g_return_val_if_fail (attributes != NULL, NULL);
window = _gdk_window_new (parent, attributes, attributes_mask);
@ -403,7 +404,7 @@ gdk_window_reparent (GdkWindow *window,
{
GdkWindowObject *private;
gboolean show;
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (new_parent == NULL || GDK_IS_WINDOW (new_parent));
g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_ROOT);
@ -480,9 +481,9 @@ _gdk_window_destroy_hierarchy (GdkWindow *window,
GdkScreen *screen;
GList *children;
GList *tmp;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
private = (GdkWindowObject*) window;
if (GDK_WINDOW_DESTROYED (window))
@ -637,8 +638,8 @@ void
gdk_window_set_user_data (GdkWindow *window,
gpointer user_data)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
((GdkWindowObject*)window)->user_data = user_data;
}
@ -655,8 +656,8 @@ void
gdk_window_get_user_data (GdkWindow *window,
gpointer *data)
{
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
*data = ((GdkWindowObject*)window)->user_data;
}
@ -986,8 +987,7 @@ gdk_window_is_viewable (GdkWindow *window)
GdkWindowObject *private = (GdkWindowObject *)window;
GdkScreen *screen;
GdkWindow *root_window;
g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
screen = gdk_drawable_get_screen (window);
@ -1041,7 +1041,6 @@ gdk_window_begin_paint_rect (GdkWindow *window,
{
GdkRegion *region;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
region = gdk_region_rectangle (rectangle);
@ -1107,8 +1106,7 @@ gdk_window_begin_paint_region (GdkWindow *window,
GdkRectangle clip_box;
GdkWindowPaint *paint;
GSList *list;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window))
@ -1180,7 +1178,6 @@ gdk_window_end_paint (GdkWindow *window)
GdkRectangle clip_box;
gint x_offset, y_offset;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window))
@ -2160,8 +2157,7 @@ void
gdk_window_clear (GdkWindow *window)
{
gint width, height;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
gdk_drawable_get_size (GDK_DRAWABLE (window), &width, &height);
@ -2190,7 +2186,6 @@ gdk_window_clear_area (GdkWindow *window,
{
GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
if (private->paint_stack)
@ -2231,7 +2226,6 @@ gdk_window_clear_area_e (GdkWindow *window,
{
GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
if (private->paint_stack)
@ -2694,9 +2688,8 @@ gdk_window_process_updates (GdkWindow *window,
{
GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_IS_PAINTABLE (private->impl))
{
GdkPaintableIface *iface = GDK_PAINTABLE_GET_IFACE (private->impl);
@ -2746,7 +2739,6 @@ gdk_window_invalidate_rect (GdkWindow *window,
GdkRegion *region;
GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window))
@ -2830,7 +2822,6 @@ gdk_window_invalidate_maybe_recurse (GdkWindow *window,
GdkRegion *visible_region;
GList *tmp_list;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window))
@ -2987,7 +2978,6 @@ gdk_window_get_update_area (GdkWindow *window)
GdkWindowObject *private = (GdkWindowObject *)window;
GdkRegion *tmp_region;
g_return_val_if_fail (window != NULL, NULL);
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
if (private->update_area)
@ -3015,7 +3005,6 @@ _gdk_window_clear_update_area (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
if (private->update_area)
@ -3042,7 +3031,6 @@ gdk_window_freeze_updates (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
private->update_freeze_count++;
@ -3059,7 +3047,6 @@ gdk_window_thaw_updates (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (private->update_freeze_count > 0);
@ -3087,7 +3074,6 @@ gdk_window_freeze_toplevel_updates_libgtk_only (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (private->window_type != GDK_WINDOW_CHILD);
@ -3109,7 +3095,6 @@ gdk_window_thaw_toplevel_updates_libgtk_only (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (private->window_type != GDK_WINDOW_CHILD);
g_return_if_fail (private->update_and_descendants_freeze_count > 0);
@ -4166,7 +4151,6 @@ gdk_window_set_composited (GdkWindow *window,
GdkWindowObject *private = (GdkWindowObject *)window;
GdkDisplay *display;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
composited = composited != FALSE;