gdk: pull more precondition checks into the generic gdkscreen.c

This commit is contained in:
Michael Natterer 2012-02-24 16:44:44 +01:00
parent 4a6658b0fa
commit 8c1c4dfd7c
4 changed files with 5 additions and 24 deletions

View File

@ -150,8 +150,6 @@ static gint
gdk_broadway_screen_get_monitor_width_mm (GdkScreen *screen,
gint monitor_num)
{
g_return_val_if_fail (monitor_num == 0, -1);
return gdk_screen_get_width_mm (screen);
}
@ -159,8 +157,6 @@ static gint
gdk_broadway_screen_get_monitor_height_mm (GdkScreen *screen,
gint monitor_num)
{
g_return_val_if_fail (monitor_num == 0, -1);
return gdk_screen_get_height_mm (screen);
}
@ -168,8 +164,6 @@ static gchar *
gdk_broadway_screen_get_monitor_plug_name (GdkScreen *screen,
gint monitor_num)
{
g_return_val_if_fail (monitor_num == 0, NULL);
return g_strdup ("browser");
}
@ -180,8 +174,6 @@ gdk_broadway_screen_get_monitor_geometry (GdkScreen *screen,
{
GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen);
g_return_if_fail (monitor_num == 0);
if (dest)
{
dest->x = 0;

View File

@ -725,6 +725,7 @@ gdk_screen_get_monitor_width_mm (GdkScreen *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 < gdk_screen_get_n_monitors (screen), -1);
return GDK_SCREEN_GET_CLASS (screen)->get_monitor_width_mm (screen, monitor_num);
}
@ -746,6 +747,7 @@ gdk_screen_get_monitor_height_mm (GdkScreen *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 < gdk_screen_get_n_monitors (screen), -1);
return GDK_SCREEN_GET_CLASS (screen)->get_monitor_height_mm (screen, monitor_num);
}
@ -770,6 +772,7 @@ gdk_screen_get_monitor_plug_name (GdkScreen *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 < gdk_screen_get_n_monitors (screen), NULL);
return GDK_SCREEN_GET_CLASS (screen)->get_monitor_plug_name (screen, monitor_num);
}
@ -799,6 +802,7 @@ gdk_screen_get_monitor_geometry (GdkScreen *screen,
{
g_return_if_fail (GDK_IS_SCREEN (screen));
g_return_if_fail (monitor_num >= 0);
g_return_if_fail (monitor_num < gdk_screen_get_n_monitors (screen));
GDK_SCREEN_GET_CLASS(screen)->get_monitor_geometry (screen, monitor_num, dest);
}
@ -829,6 +833,7 @@ gdk_screen_get_monitor_workarea (GdkScreen *screen,
{
g_return_if_fail (GDK_IS_SCREEN (screen));
g_return_if_fail (monitor_num >= 0);
g_return_if_fail (monitor_num < gdk_screen_get_n_monitors (screen));
GDK_SCREEN_GET_CLASS (screen)->get_monitor_workarea (screen, monitor_num, dest);
}

View File

@ -220,8 +220,6 @@ gdk_wayland_screen_get_monitor_width_mm (GdkScreen *screen,
{
GdkScreenWayland *screen_wayland = GDK_SCREEN_WAYLAND (screen);
g_return_val_if_fail (monitor_num < screen_wayland->n_monitors, -1);
return screen_wayland->monitors[monitor_num].width_mm;
}
@ -231,8 +229,6 @@ gdk_wayland_screen_get_monitor_height_mm (GdkScreen *screen,
{
GdkScreenWayland *screen_wayland = GDK_SCREEN_WAYLAND (screen);
g_return_val_if_fail (monitor_num < screen_wayland->n_monitors, -1);
return screen_wayland->monitors[monitor_num].height_mm;
}
@ -242,8 +238,6 @@ gdk_wayland_screen_get_monitor_plug_name (GdkScreen *screen,
{
GdkScreenWayland *screen_wayland = GDK_SCREEN_WAYLAND (screen);
g_return_val_if_fail (monitor_num < screen_wayland->n_monitors, NULL);
return g_strdup (screen_wayland->monitors[monitor_num].output_name);
}
@ -254,8 +248,6 @@ gdk_wayland_screen_get_monitor_geometry (GdkScreen *screen,
{
GdkScreenWayland *screen_wayland = GDK_SCREEN_WAYLAND (screen);
g_return_if_fail (monitor_num < screen_wayland->n_monitors);
if (dest)
*dest = screen_wayland->monitors[monitor_num].geometry;
}

View File

@ -213,8 +213,6 @@ gdk_x11_screen_get_monitor_width_mm (GdkScreen *screen,
{
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
g_return_val_if_fail (monitor_num < x11_screen->n_monitors, -1);
return x11_screen->monitors[monitor_num].width_mm;
}
@ -224,8 +222,6 @@ gdk_x11_screen_get_monitor_height_mm (GdkScreen *screen,
{
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
g_return_val_if_fail (monitor_num < x11_screen->n_monitors, -1);
return x11_screen->monitors[monitor_num].height_mm;
}
@ -235,8 +231,6 @@ gdk_x11_screen_get_monitor_plug_name (GdkScreen *screen,
{
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
g_return_val_if_fail (monitor_num < x11_screen->n_monitors, NULL);
return g_strdup (x11_screen->monitors[monitor_num].output_name);
}
@ -273,8 +267,6 @@ gdk_x11_screen_get_monitor_geometry (GdkScreen *screen,
{
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
g_return_if_fail (monitor_num < x11_screen->n_monitors);
if (dest)
*dest = x11_screen->monitors[monitor_num].geometry;
}