summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@novell.com>2008-12-04 00:29:21 +0000
committerFederico Mena Quintero <federico@src.gnome.org>2008-12-04 00:29:21 +0000
commitbfc09e4cdbd50d71aa92f0e867fcb31f2eddaec0 (patch)
tree4ac8f694341e73f60d18f2aa91b4f63b302346cf
parent5b67d74ea12415ab7c1a75d1cdfc9e9943ced0f3 (diff)
downloadgnome-desktop-bfc09e4cdbd50d71aa92f0e867fcb31f2eddaec0.tar.gz
Report errors from crtc_assignment_new()
Signed-off-by: Federico Mena Quintero <federico@novell.com> svn path=/trunk/; revision=5313
-rw-r--r--libgnome-desktop/gnome-rr-config.c20
-rw-r--r--libgnome-desktop/libgnomeui/gnome-rr.h1
2 files changed, 16 insertions, 5 deletions
diff --git a/libgnome-desktop/gnome-rr-config.c b/libgnome-desktop/gnome-rr-config.c
index 8bd47305..3434e9dc 100644
--- a/libgnome-desktop/gnome-rr-config.c
+++ b/libgnome-desktop/gnome-rr-config.c
@@ -69,7 +69,8 @@ typedef struct CrtcAssignment CrtcAssignment;
static gboolean crtc_assignment_apply (CrtcAssignment *assign,
GError **error);
static CrtcAssignment *crtc_assignment_new (GnomeRRScreen *screen,
- GnomeOutputInfo **outputs);
+ GnomeOutputInfo **outputs,
+ GError **error);
static void crtc_assignment_free (CrtcAssignment *assign);
static void output_free (GnomeOutputInfo *output);
static GnomeOutputInfo *output_copy (GnomeOutputInfo *output);
@@ -1153,7 +1154,7 @@ gnome_rr_config_apply (GnomeRRConfig *config,
outputs = make_outputs (config);
- assignment = crtc_assignment_new (screen, outputs);
+ assignment = crtc_assignment_new (screen, outputs, error);
outputs_free (outputs);
@@ -1504,12 +1505,10 @@ get_required_virtual_size (CrtcAssignment *assign, int *width, int *height)
}
static CrtcAssignment *
-crtc_assignment_new (GnomeRRScreen *screen, GnomeOutputInfo **outputs)
+crtc_assignment_new (GnomeRRScreen *screen, GnomeOutputInfo **outputs, GError **error)
{
CrtcAssignment *assignment = g_new0 (CrtcAssignment, 1);
- /* FMQ: return error */
-
assignment->info = g_hash_table_new_full (
g_direct_hash, g_direct_equal, NULL, (GFreeFunc)crtc_info_free);
@@ -1526,6 +1525,14 @@ crtc_assignment_new (GnomeRRScreen *screen, GnomeOutputInfo **outputs)
if (width < min_width || width > max_width ||
height < min_height || height > max_height)
{
+ g_set_error (error, GNOME_RR_ERROR, GNOME_RR_ERROR_BOUNDS_ERROR,
+ _("required virtual size does not fit available size: "
+ "req_width = %d, req_height = %d, "
+ "min_width = %d, min_height = %d, "
+ "max_width = %d, max_height = %d"),
+ width, height,
+ min_width, min_height,
+ max_width, max_height);
goto fail;
}
@@ -1533,6 +1540,9 @@ crtc_assignment_new (GnomeRRScreen *screen, GnomeOutputInfo **outputs)
return assignment;
}
+ else
+ g_set_error (error, GNOME_RR_ERROR, GNOME_RR_ERROR_CRTC_ASSIGNMENT,
+ _("could not find a suitable configuration of screens"));
fail:
crtc_assignment_free (assignment);
diff --git a/libgnome-desktop/libgnomeui/gnome-rr.h b/libgnome-desktop/libgnomeui/gnome-rr.h
index d171bbee..5daa02ab 100644
--- a/libgnome-desktop/libgnomeui/gnome-rr.h
+++ b/libgnome-desktop/libgnomeui/gnome-rr.h
@@ -59,6 +59,7 @@ typedef enum {
GNOME_RR_ERROR_NO_RANDR_EXTENSION, /* RANDR extension is not present */
GNOME_RR_ERROR_RANDR_ERROR, /* generic/undescribed error from the underlying XRR API */
GNOME_RR_ERROR_BOUNDS_ERROR, /* requested bounds of a CRTC are outside the maximum size */
+ GNOME_RR_ERROR_CRTC_ASSIGNMENT, /* could not assign CRTCs to outputs */
} GnomeRRError;
/* GnomeRRScreen */