summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Natterer <mitch@gimp.org>2012-02-21 17:19:35 +0100
committerMichael Natterer <mitch@gimp.org>2012-02-21 17:19:35 +0100
commit427b88f54186583febeecebe871031b6e56ab7f6 (patch)
treeb5c89b64fb65d779100d7d10a9710e14c32fc138
parent8317fed2b97b9cd1625247f7af5bb0c380a27a21 (diff)
downloadgtk+-427b88f54186583febeecebe871031b6e56ab7f6.tar.gz
GdkScreen: fix precondition checks in the public API
Move g_return_if_fail() stuff from the backends to the public functions in gdkscreen.c itself, and some fixes for ugly formatting in the various gdkscreen-backend.c files.
-rw-r--r--gdk/broadway/gdkscreen-broadway.c39
-rw-r--r--gdk/gdkscreen.c93
-rw-r--r--gdk/quartz/gdkscreen-quartz.c3
-rw-r--r--gdk/wayland/gdkscreen-wayland.c28
-rw-r--r--gdk/win32/gdkscreen-win32.c29
-rw-r--r--gdk/x11/gdkscreen-x11.c63
6 files changed, 99 insertions, 156 deletions
diff --git a/gdk/broadway/gdkscreen-broadway.c b/gdk/broadway/gdkscreen-broadway.c
index 899ba9f729..f970be91e1 100644
--- a/gdk/broadway/gdkscreen-broadway.c
+++ b/gdk/broadway/gdkscreen-broadway.c
@@ -34,8 +34,8 @@
#include <stdlib.h>
#include <string.h>
-static void gdk_broadway_screen_dispose (GObject *object);
-static void gdk_broadway_screen_finalize (GObject *object);
+static void gdk_broadway_screen_dispose (GObject *object);
+static void gdk_broadway_screen_finalize (GObject *object);
G_DEFINE_TYPE (GdkBroadwayScreen, gdk_broadway_screen, GDK_TYPE_SCREEN)
@@ -49,61 +49,48 @@ gdk_broadway_screen_init (GdkBroadwayScreen *screen)
static GdkDisplay *
gdk_broadway_screen_get_display (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
return GDK_BROADWAY_SCREEN (screen)->display;
}
static gint
gdk_broadway_screen_get_width (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return GDK_BROADWAY_SCREEN (screen)->width;
}
static gint
gdk_broadway_screen_get_height (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return GDK_BROADWAY_SCREEN (screen)->height;
}
static gint
gdk_broadway_screen_get_width_mm (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return gdk_screen_get_width (screen) * 25.4 / 96;
}
static gint
gdk_broadway_screen_get_height_mm (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return gdk_screen_get_height (screen) * 25.4 / 96;
}
static gint
gdk_broadway_screen_get_number (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return 0;
}
static GdkWindow *
gdk_broadway_screen_get_root_window (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
return GDK_BROADWAY_SCREEN (screen)->root_window;
}
void
-_gdk_broadway_screen_size_changed (GdkScreen *screen, BroadwayInputScreenResizeNotify *msg)
+_gdk_broadway_screen_size_changed (GdkScreen *screen,
+ BroadwayInputScreenResizeNotify *msg)
{
GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen);
gint width, height;
@@ -150,16 +137,12 @@ gdk_broadway_screen_finalize (GObject *object)
static gint
gdk_broadway_screen_get_n_monitors (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return 1;
}
static gint
gdk_broadway_screen_get_primary_monitor (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return 0;
}
@@ -167,7 +150,6 @@ static gint
gdk_broadway_screen_get_monitor_width_mm (GdkScreen *screen,
gint monitor_num)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
g_return_val_if_fail (monitor_num == 0, -1);
return gdk_screen_get_width_mm (screen);
@@ -177,7 +159,6 @@ static gint
gdk_broadway_screen_get_monitor_height_mm (GdkScreen *screen,
gint monitor_num)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
g_return_val_if_fail (monitor_num == 0, -1);
return gdk_screen_get_height_mm (screen);
@@ -187,7 +168,6 @@ static gchar *
gdk_broadway_screen_get_monitor_plug_name (GdkScreen *screen,
gint monitor_num)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
g_return_val_if_fail (monitor_num == 0, NULL);
return g_strdup ("browser");
@@ -200,7 +180,6 @@ gdk_broadway_screen_get_monitor_geometry (GdkScreen *screen,
{
GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen);
- g_return_if_fail (GDK_IS_SCREEN (screen));
g_return_if_fail (monitor_num == 0);
if (dest)
@@ -215,11 +194,7 @@ gdk_broadway_screen_get_monitor_geometry (GdkScreen *screen,
static GdkVisual *
gdk_broadway_screen_get_rgba_visual (GdkScreen *screen)
{
- GdkBroadwayScreen *broadway_screen;
-
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
- broadway_screen = GDK_BROADWAY_SCREEN (screen);
+ GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen);
return broadway_screen->rgba_visual;
}
@@ -254,8 +229,6 @@ _gdk_broadway_screen_setup (GdkScreen *screen)
static gboolean
gdk_broadway_screen_is_composited (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
-
return FALSE;
}
@@ -263,8 +236,6 @@ gdk_broadway_screen_is_composited (GdkScreen *screen)
static gchar *
gdk_broadway_screen_make_display_name (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
return g_strdup ("browser");
}
diff --git a/gdk/gdkscreen.c b/gdk/gdkscreen.c
index 9493e168ff..0ed04b14c1 100644
--- a/gdk/gdkscreen.c
+++ b/gdk/gdkscreen.c
@@ -548,7 +548,9 @@ gdk_screen_set_property (GObject *object,
GdkDisplay *
gdk_screen_get_display (GdkScreen *screen)
{
- return GDK_SCREEN_GET_CLASS(screen)->get_display (screen);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+
+ return GDK_SCREEN_GET_CLASS (screen)->get_display (screen);
}
@@ -565,7 +567,9 @@ gdk_screen_get_display (GdkScreen *screen)
gint
gdk_screen_get_width (GdkScreen *screen)
{
- return GDK_SCREEN_GET_CLASS(screen)->get_width (screen);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
+
+ return GDK_SCREEN_GET_CLASS (screen)->get_width (screen);
}
/**
@@ -581,7 +585,9 @@ gdk_screen_get_width (GdkScreen *screen)
gint
gdk_screen_get_height (GdkScreen *screen)
{
- return GDK_SCREEN_GET_CLASS(screen)->get_height (screen);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
+
+ return GDK_SCREEN_GET_CLASS (screen)->get_height (screen);
}
/**
@@ -598,7 +604,9 @@ gdk_screen_get_height (GdkScreen *screen)
gint
gdk_screen_get_width_mm (GdkScreen *screen)
{
- return GDK_SCREEN_GET_CLASS(screen)->get_width_mm (screen);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
+
+ return GDK_SCREEN_GET_CLASS (screen)->get_width_mm (screen);
}
/**
@@ -615,7 +623,9 @@ gdk_screen_get_width_mm (GdkScreen *screen)
gint
gdk_screen_get_height_mm (GdkScreen *screen)
{
- return GDK_SCREEN_GET_CLASS(screen)->get_height_mm (screen);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
+
+ return GDK_SCREEN_GET_CLASS (screen)->get_height_mm (screen);
}
/**
@@ -632,7 +642,9 @@ gdk_screen_get_height_mm (GdkScreen *screen)
gint
gdk_screen_get_number (GdkScreen *screen)
{
- return GDK_SCREEN_GET_CLASS(screen)->get_number (screen);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
+
+ return GDK_SCREEN_GET_CLASS (screen)->get_number (screen);
}
/**
@@ -648,7 +660,9 @@ gdk_screen_get_number (GdkScreen *screen)
GdkWindow *
gdk_screen_get_root_window (GdkScreen *screen)
{
- return GDK_SCREEN_GET_CLASS(screen)->get_root_window (screen);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+
+ return GDK_SCREEN_GET_CLASS (screen)->get_root_window (screen);
}
/**
@@ -664,7 +678,9 @@ gdk_screen_get_root_window (GdkScreen *screen)
gint
gdk_screen_get_n_monitors (GdkScreen *screen)
{
- return GDK_SCREEN_GET_CLASS(screen)->get_n_monitors (screen);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
+
+ return GDK_SCREEN_GET_CLASS (screen)->get_n_monitors (screen);
}
/**
@@ -687,7 +703,9 @@ gdk_screen_get_n_monitors (GdkScreen *screen)
gint
gdk_screen_get_primary_monitor (GdkScreen *screen)
{
- return GDK_SCREEN_GET_CLASS(screen)->get_primary_monitor (screen);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
+
+ return GDK_SCREEN_GET_CLASS (screen)->get_primary_monitor (screen);
}
/**
@@ -705,7 +723,10 @@ gint
gdk_screen_get_monitor_width_mm (GdkScreen *screen,
gint monitor_num)
{
- return GDK_SCREEN_GET_CLASS(screen)->get_monitor_width_mm (screen, monitor_num);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
+ g_return_val_if_fail (monitor_num >= 0, -1);
+
+ return GDK_SCREEN_GET_CLASS (screen)->get_monitor_width_mm (screen, monitor_num);
}
/**
@@ -723,7 +744,10 @@ gint
gdk_screen_get_monitor_height_mm (GdkScreen *screen,
gint monitor_num)
{
- return GDK_SCREEN_GET_CLASS(screen)->get_monitor_height_mm (screen, monitor_num);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
+ g_return_val_if_fail (monitor_num >= 0, -1);
+
+ return GDK_SCREEN_GET_CLASS (screen)->get_monitor_height_mm (screen, monitor_num);
}
/**
@@ -744,7 +768,10 @@ gchar *
gdk_screen_get_monitor_plug_name (GdkScreen *screen,
gint monitor_num)
{
- return GDK_SCREEN_GET_CLASS(screen)->get_monitor_plug_name (screen, monitor_num);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+ g_return_val_if_fail (monitor_num >= 0, NULL);
+
+ return GDK_SCREEN_GET_CLASS (screen)->get_monitor_plug_name (screen, monitor_num);
}
/**
@@ -770,6 +797,9 @@ gdk_screen_get_monitor_geometry (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest)
{
+ g_return_if_fail (GDK_IS_SCREEN (screen));
+ g_return_if_fail (monitor_num >= 0);
+
GDK_SCREEN_GET_CLASS(screen)->get_monitor_geometry (screen, monitor_num, dest);
}
@@ -797,7 +827,10 @@ gdk_screen_get_monitor_workarea (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest)
{
- GDK_SCREEN_GET_CLASS(screen)->get_monitor_workarea (screen, monitor_num, dest);
+ g_return_if_fail (GDK_IS_SCREEN (screen));
+ g_return_if_fail (monitor_num >= 0);
+
+ GDK_SCREEN_GET_CLASS (screen)->get_monitor_workarea (screen, monitor_num, dest);
}
/**
@@ -819,7 +852,9 @@ gdk_screen_get_monitor_workarea (GdkScreen *screen,
GList *
gdk_screen_list_visuals (GdkScreen *screen)
{
- return GDK_SCREEN_GET_CLASS(screen)->list_visuals (screen);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+
+ return GDK_SCREEN_GET_CLASS (screen)->list_visuals (screen);
}
/**
@@ -837,7 +872,9 @@ gdk_screen_list_visuals (GdkScreen *screen)
GdkVisual *
gdk_screen_get_system_visual (GdkScreen * screen)
{
- return GDK_SCREEN_GET_CLASS(screen)->get_system_visual (screen);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+
+ return GDK_SCREEN_GET_CLASS (screen)->get_system_visual (screen);
}
/**
@@ -866,7 +903,9 @@ gdk_screen_get_system_visual (GdkScreen * screen)
GdkVisual *
gdk_screen_get_rgba_visual (GdkScreen *screen)
{
- return GDK_SCREEN_GET_CLASS(screen)->get_rgba_visual (screen);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+
+ return GDK_SCREEN_GET_CLASS (screen)->get_rgba_visual (screen);
}
/**
@@ -888,7 +927,9 @@ gdk_screen_get_rgba_visual (GdkScreen *screen)
gboolean
gdk_screen_is_composited (GdkScreen *screen)
{
- return GDK_SCREEN_GET_CLASS(screen)->is_composited (screen);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
+
+ return GDK_SCREEN_GET_CLASS (screen)->is_composited (screen);
}
/**
@@ -905,7 +946,9 @@ gdk_screen_is_composited (GdkScreen *screen)
gchar *
gdk_screen_make_display_name (GdkScreen *screen)
{
- return GDK_SCREEN_GET_CLASS(screen)->make_display_name (screen);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+
+ return GDK_SCREEN_GET_CLASS (screen)->make_display_name (screen);
}
/**
@@ -934,7 +977,9 @@ gdk_screen_make_display_name (GdkScreen *screen)
GdkWindow *
gdk_screen_get_active_window (GdkScreen *screen)
{
- return GDK_SCREEN_GET_CLASS(screen)->get_active_window (screen);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+
+ return GDK_SCREEN_GET_CLASS (screen)->get_active_window (screen);
}
/**
@@ -966,7 +1011,9 @@ gdk_screen_get_active_window (GdkScreen *screen)
GList *
gdk_screen_get_window_stack (GdkScreen *screen)
{
- return GDK_SCREEN_GET_CLASS(screen)->get_window_stack (screen);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+
+ return GDK_SCREEN_GET_CLASS (screen)->get_window_stack (screen);
}
/**
@@ -991,5 +1038,9 @@ gdk_screen_get_setting (GdkScreen *screen,
const gchar *name,
GValue *value)
{
- return GDK_SCREEN_GET_CLASS(screen)->get_setting (screen, name, value);
+ g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
+ g_return_val_if_fail (name != NULL, FALSE);
+ g_return_val_if_fail (value != NULL, FALSE);
+
+ return GDK_SCREEN_GET_CLASS (screen)->get_setting (screen, name, value);
}
diff --git a/gdk/quartz/gdkscreen-quartz.c b/gdk/quartz/gdkscreen-quartz.c
index d104571ce6..55f4ca08a1 100644
--- a/gdk/quartz/gdkscreen-quartz.c
+++ b/gdk/quartz/gdkscreen-quartz.c
@@ -291,7 +291,6 @@ gdk_quartz_screen_get_display (GdkScreen *screen)
return _gdk_display;
}
-
static GdkWindow *
gdk_quartz_screen_get_root_window (GdkScreen *screen)
{
@@ -304,7 +303,7 @@ gdk_quartz_screen_get_number (GdkScreen *screen)
return 0;
}
-gchar *
+gchar *
_gdk_windowing_substitute_screen_number (const gchar *display_name,
int screen_number)
{
diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c
index 310fc15a72..47f70ef41e 100644
--- a/gdk/wayland/gdkscreen-wayland.c
+++ b/gdk/wayland/gdkscreen-wayland.c
@@ -163,72 +163,54 @@ gdk_wayland_screen_finalize (GObject *object)
static GdkDisplay *
gdk_wayland_screen_get_display (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
return GDK_SCREEN_WAYLAND (screen)->display;
}
static gint
gdk_wayland_screen_get_width (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return GDK_SCREEN_WAYLAND (screen)->width;
}
static gint
gdk_wayland_screen_get_height (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return GDK_SCREEN_WAYLAND (screen)->height;
}
static gint
gdk_wayland_screen_get_width_mm (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return GDK_SCREEN_WAYLAND (screen)->width_mm;
}
static gint
gdk_wayland_screen_get_height_mm (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return GDK_SCREEN_WAYLAND (screen)->height_mm;
}
static gint
gdk_wayland_screen_get_number (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return 0;
}
static GdkWindow *
gdk_wayland_screen_get_root_window (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
return GDK_SCREEN_WAYLAND (screen)->root_window;
}
static gint
gdk_wayland_screen_get_n_monitors (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return GDK_SCREEN_WAYLAND (screen)->n_monitors;
}
static gint
gdk_wayland_screen_get_primary_monitor (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return GDK_SCREEN_WAYLAND (screen)->primary_monitor;
}
@@ -238,8 +220,6 @@ gdk_wayland_screen_get_monitor_width_mm (GdkScreen *screen,
{
GdkScreenWayland *screen_wayland = GDK_SCREEN_WAYLAND (screen);
- g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
- g_return_val_if_fail (monitor_num >= 0, -1);
g_return_val_if_fail (monitor_num < screen_wayland->n_monitors, -1);
return screen_wayland->monitors[monitor_num].width_mm;
@@ -251,8 +231,6 @@ gdk_wayland_screen_get_monitor_height_mm (GdkScreen *screen,
{
GdkScreenWayland *screen_wayland = GDK_SCREEN_WAYLAND (screen);
- g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
- g_return_val_if_fail (monitor_num >= 0, -1);
g_return_val_if_fail (monitor_num < screen_wayland->n_monitors, -1);
return screen_wayland->monitors[monitor_num].height_mm;
@@ -264,8 +242,6 @@ gdk_wayland_screen_get_monitor_plug_name (GdkScreen *screen,
{
GdkScreenWayland *screen_wayland = GDK_SCREEN_WAYLAND (screen);
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
- g_return_val_if_fail (monitor_num >= 0, NULL);
g_return_val_if_fail (monitor_num < screen_wayland->n_monitors, NULL);
return g_strdup (screen_wayland->monitors[monitor_num].output_name);
@@ -278,8 +254,6 @@ gdk_wayland_screen_get_monitor_geometry (GdkScreen *screen,
{
GdkScreenWayland *screen_wayland = GDK_SCREEN_WAYLAND (screen);
- g_return_if_fail (GDK_IS_SCREEN (screen));
- g_return_if_fail (monitor_num >= 0);
g_return_if_fail (monitor_num < screen_wayland->n_monitors);
if (dest)
@@ -313,8 +287,6 @@ gdk_wayland_screen_make_display_name (GdkScreen *screen)
static GdkWindow *
gdk_wayland_screen_get_active_window (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
return NULL;
}
diff --git a/gdk/win32/gdkscreen-win32.c b/gdk/win32/gdkscreen-win32.c
index 457858a2e7..6ee2242a22 100644
--- a/gdk/win32/gdkscreen-win32.c
+++ b/gdk/win32/gdkscreen-win32.c
@@ -27,13 +27,16 @@ struct _GdkWin32Screen
{
GdkScreen parent_instance;
};
+
struct _GdkWin32ScreenClass
{
GdkScreenClass parent_class;
};
+
G_DEFINE_TYPE (GdkWin32Screen, gdk_win32_screen, GDK_TYPE_SCREEN)
+
static void
-gdk_win32_screen_init(GdkWin32Screen *display)
+gdk_win32_screen_init (GdkWin32Screen *display)
{
}
@@ -91,45 +94,41 @@ gdk_win32_screen_get_primary_monitor (GdkScreen *screen)
static gint
gdk_win32_screen_get_monitor_width_mm (GdkScreen *screen,
- gint num_monitor)
+ gint num_monitor)
{
g_return_val_if_fail (screen == _gdk_screen, 0);
g_return_val_if_fail (num_monitor < _gdk_num_monitors, 0);
- g_return_val_if_fail (num_monitor >= 0, 0);
return _gdk_monitors[num_monitor].width_mm;
}
static gint
gdk_win32_screen_get_monitor_height_mm (GdkScreen *screen,
- gint num_monitor)
+ gint num_monitor)
{
g_return_val_if_fail (screen == _gdk_screen, 0);
g_return_val_if_fail (num_monitor < _gdk_num_monitors, 0);
- g_return_val_if_fail (num_monitor >= 0, 0);
return _gdk_monitors[num_monitor].height_mm;
}
static gchar *
gdk_win32_screen_get_monitor_plug_name (GdkScreen *screen,
- gint num_monitor)
+ gint num_monitor)
{
g_return_val_if_fail (screen == _gdk_screen, 0);
g_return_val_if_fail (num_monitor < _gdk_num_monitors, 0);
- g_return_val_if_fail (num_monitor >= 0, 0);
return g_strdup (_gdk_monitors[num_monitor].name);
}
static void
-gdk_win32_screen_get_monitor_geometry (GdkScreen *screen,
- gint num_monitor,
- GdkRectangle *dest)
+gdk_win32_screen_get_monitor_geometry (GdkScreen *screen,
+ gint num_monitor,
+ GdkRectangle *dest)
{
g_return_if_fail (screen == _gdk_screen);
g_return_if_fail (num_monitor < _gdk_num_monitors);
- g_return_if_fail (num_monitor >= 0);
*dest = _gdk_monitors[num_monitor].rect;
}
@@ -141,16 +140,16 @@ gdk_win32_screen_get_rgba_visual (GdkScreen *screen)
return NULL;
}
-
+
static gint
gdk_win32_screen_get_number (GdkScreen *screen)
{
- g_return_val_if_fail (screen == _gdk_screen, 0);
-
+ g_return_val_if_fail (screen == _gdk_screen, 0);
+
return 0;
}
-gchar *
+gchar *
_gdk_windowing_substitute_screen_number (const gchar *display_name,
int screen_number)
{
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
index 58bcd92ad0..a1986d7c0a 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -93,56 +93,42 @@ gdk_x11_screen_init (GdkX11Screen *screen)
static GdkDisplay *
gdk_x11_screen_get_display (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
return GDK_X11_SCREEN (screen)->display;
}
static gint
gdk_x11_screen_get_width (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return WidthOfScreen (GDK_X11_SCREEN (screen)->xscreen);
}
static gint
gdk_x11_screen_get_height (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return HeightOfScreen (GDK_X11_SCREEN (screen)->xscreen);
}
static gint
gdk_x11_screen_get_width_mm (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return WidthMMOfScreen (GDK_X11_SCREEN (screen)->xscreen);
}
static gint
gdk_x11_screen_get_height_mm (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return HeightMMOfScreen (GDK_X11_SCREEN (screen)->xscreen);
}
static gint
gdk_x11_screen_get_number (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return GDK_X11_SCREEN (screen)->screen_num;
}
static GdkWindow *
gdk_x11_screen_get_root_window (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
return GDK_X11_SCREEN (screen)->root_window;
}
@@ -212,27 +198,21 @@ gdk_x11_screen_finalize (GObject *object)
static gint
gdk_x11_screen_get_n_monitors (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return GDK_X11_SCREEN (screen)->n_monitors;
}
static gint
gdk_x11_screen_get_primary_monitor (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return GDK_X11_SCREEN (screen)->primary_monitor;
}
static gint
-gdk_x11_screen_get_monitor_width_mm (GdkScreen *screen,
- gint monitor_num)
+gdk_x11_screen_get_monitor_width_mm (GdkScreen *screen,
+ gint monitor_num)
{
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
- g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
- g_return_val_if_fail (monitor_num >= 0, -1);
g_return_val_if_fail (monitor_num < x11_screen->n_monitors, -1);
return x11_screen->monitors[monitor_num].width_mm;
@@ -244,8 +224,6 @@ gdk_x11_screen_get_monitor_height_mm (GdkScreen *screen,
{
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
- g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
- g_return_val_if_fail (monitor_num >= 0, -1);
g_return_val_if_fail (monitor_num < x11_screen->n_monitors, -1);
return x11_screen->monitors[monitor_num].height_mm;
@@ -257,8 +235,6 @@ gdk_x11_screen_get_monitor_plug_name (GdkScreen *screen,
{
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
- g_return_val_if_fail (monitor_num >= 0, NULL);
g_return_val_if_fail (monitor_num < x11_screen->n_monitors, NULL);
return g_strdup (x11_screen->monitors[monitor_num].output_name);
@@ -297,8 +273,6 @@ gdk_x11_screen_get_monitor_geometry (GdkScreen *screen,
{
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
- g_return_if_fail (GDK_IS_SCREEN (screen));
- g_return_if_fail (monitor_num >= 0);
g_return_if_fail (monitor_num < x11_screen->n_monitors);
if (dest)
@@ -415,11 +389,7 @@ gdk_x11_screen_get_monitor_workarea (GdkScreen *screen,
static GdkVisual *
gdk_x11_screen_get_rgba_visual (GdkScreen *screen)
{
- GdkX11Screen *x11_screen;
-
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
- x11_screen = GDK_X11_SCREEN (screen);
+ GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
return x11_screen->rgba_visual;
}
@@ -941,11 +911,7 @@ _gdk_x11_screen_setup (GdkScreen *screen)
static gboolean
gdk_x11_screen_is_composited (GdkScreen *screen)
{
- GdkX11Screen *x11_screen;
-
- g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
-
- x11_screen = GDK_X11_SCREEN (screen);
+ GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
return x11_screen->is_composited;
}
@@ -1093,8 +1059,6 @@ gdk_x11_screen_make_display_name (GdkScreen *screen)
{
const gchar *old_display;
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
old_display = gdk_display_get_name (gdk_screen_get_display (screen));
return substitute_screen_number (old_display,
@@ -1104,7 +1068,7 @@ gdk_x11_screen_make_display_name (GdkScreen *screen)
static GdkWindow *
gdk_x11_screen_get_active_window (GdkScreen *screen)
{
- GdkX11Screen *x11_screen;
+ GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
GdkWindow *ret = NULL;
Atom type_return;
gint format_return;
@@ -1112,14 +1076,10 @@ gdk_x11_screen_get_active_window (GdkScreen *screen)
gulong bytes_after_return;
guchar *data = NULL;
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
if (!gdk_x11_screen_supports_net_wm_hint (screen,
gdk_atom_intern_static_string ("_NET_ACTIVE_WINDOW")))
return NULL;
- x11_screen = GDK_X11_SCREEN (screen);
-
if (XGetWindowProperty (x11_screen->xdisplay, x11_screen->xroot_window,
gdk_x11_get_xatom_by_name_for_display (x11_screen->display,
"_NET_ACTIVE_WINDOW"),
@@ -1149,7 +1109,7 @@ gdk_x11_screen_get_active_window (GdkScreen *screen)
static GList *
gdk_x11_screen_get_window_stack (GdkScreen *screen)
{
- GdkX11Screen *x11_screen;
+ GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
GList *ret = NULL;
Atom type_return;
gint format_return;
@@ -1157,14 +1117,10 @@ gdk_x11_screen_get_window_stack (GdkScreen *screen)
gulong bytes_after_return;
guchar *data = NULL;
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
if (!gdk_x11_screen_supports_net_wm_hint (screen,
gdk_atom_intern_static_string ("_NET_CLIENT_LIST_STACKING")))
return NULL;
- x11_screen = GDK_X11_SCREEN (screen);
-
if (XGetWindowProperty (x11_screen->xdisplay, x11_screen->xroot_window,
gdk_x11_get_xatom_by_name_for_display (x11_screen->display,
"_NET_CLIENT_LIST_STACKING"),
@@ -1219,19 +1175,14 @@ gdk_x11_screen_get_setting (GdkScreen *screen,
const gchar *name,
GValue *value)
{
-
+ GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
const char *xsettings_name = NULL;
XSettingsResult result;
XSettingsSetting *setting = NULL;
- GdkX11Screen *x11_screen;
gboolean success = FALSE;
gint i;
GValue tmp_val = G_VALUE_INIT;
- g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
-
- x11_screen = GDK_X11_SCREEN (screen);
-
for (i = 0; i < GDK_SETTINGS_N_ELEMENTS(); i++)
if (strcmp (GDK_SETTINGS_GDK_NAME (i), name) == 0)
{