gtk+ r21695 - in trunk: . gdk
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r21695 - in trunk: . gdk
- Date: Tue, 21 Oct 2008 21:42:40 +0000 (UTC)
Author: mitch
Date: Tue Oct 21 21:42:39 2008
New Revision: 21695
URL: http://svn.gnome.org/viewvc/gtk+?rev=21695&view=rev
Log:
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.
Modified:
trunk/ChangeLog
trunk/gdk/gdkdraw.c
trunk/gdk/gdkimage.c
trunk/gdk/gdkscreen.c
trunk/gdk/gdkwindow.c
Modified: trunk/gdk/gdkdraw.c
==============================================================================
--- trunk/gdk/gdkdraw.c (original)
+++ trunk/gdk/gdkdraw.c Tue Oct 21 21:42:39 2008
@@ -347,8 +347,6 @@
{
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 @@
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 @@
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 @@
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);
Modified: trunk/gdk/gdkimage.c
==============================================================================
--- trunk/gdk/gdkimage.c (original)
+++ trunk/gdk/gdkimage.c Tue Oct 21 21:42:39 2008
@@ -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 @@
image->colormap = colormap;
g_object_ref (image->colormap);
}
-
}
/**
Modified: trunk/gdk/gdkscreen.c
==============================================================================
--- trunk/gdk/gdkscreen.c (original)
+++ trunk/gdk/gdkscreen.c Tue Oct 21 21:42:39 2008
@@ -152,7 +152,7 @@
static void
gdk_screen_init (GdkScreen *screen)
{
- screen->resolution = -1.;
+ screen->resolution = -1.;
}
static void
@@ -308,8 +308,9 @@
{
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 @@
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 @@
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 @@
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 @@
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 (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 (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 @@
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 @@
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 @@
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
Modified: trunk/gdk/gdkwindow.c
==============================================================================
--- trunk/gdk/gdkwindow.c (original)
+++ trunk/gdk/gdkwindow.c Tue Oct 21 21:42:39 2008
@@ -368,7 +368,8 @@
{
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 @@
{
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 @@
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 @@
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 @@
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 @@
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 @@
{
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 @@
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 @@
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 @@
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 @@
{
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 @@
{
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 @@
{
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 @@
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 @@
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 @@
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 @@
{
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 @@
{
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 @@
{
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 @@
{
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 @@
{
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 @@
GdkWindowObject *private = (GdkWindowObject *)window;
GdkDisplay *display;
- g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
composited = composited != FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]