gnome-desktop r5107 - in branches/randr-12/libgnome-desktop: . libgnomeui



Author: ssp
Date: Tue Jun 10 17:31:07 2008
New Revision: 5107
URL: http://svn.gnome.org/viewvc/gnome-desktop?rev=5107&view=rev

Log:
Tue Jun 10 13:29:52 2008  SÃren Sandmann  <sandmann redhat com>

	* Put RW* into the gnome namespace; various formatting fixes



Modified:
   branches/randr-12/libgnome-desktop/ChangeLog
   branches/randr-12/libgnome-desktop/libgnomeui/monitor-db.h
   branches/randr-12/libgnome-desktop/libgnomeui/randrwrap.h
   branches/randr-12/libgnome-desktop/monitor-db.c
   branches/randr-12/libgnome-desktop/randrwrap.c

Modified: branches/randr-12/libgnome-desktop/libgnomeui/monitor-db.h
==============================================================================
--- branches/randr-12/libgnome-desktop/libgnomeui/monitor-db.h	(original)
+++ branches/randr-12/libgnome-desktop/libgnomeui/monitor-db.h	Tue Jun 10 17:31:07 2008
@@ -44,7 +44,7 @@
     int		rate;
     int		x;
     int		y;
-    RWRotation	rotation;
+    GnomeRRRotation	rotation;
 
     gboolean	connected;
     char	vendor[4];
@@ -66,14 +66,14 @@
 };
 
 void            configuration_free         (Configuration  *configuration);
-Configuration  *configuration_new_current  (RWScreen       *screen);
+Configuration  *configuration_new_current  (GnomeRRScreen       *screen);
 gboolean        configuration_match        (Configuration  *config1,
 					    Configuration  *config2);
 gboolean        configuration_save         (Configuration  *configuration,
 					    GError        **err);
 void		configuration_sanitize     (Configuration  *configuration);
-gboolean	configuration_apply_stored (RWScreen       *screen);
+gboolean	configuration_apply_stored (GnomeRRScreen       *screen);
 gboolean	configuration_applicable   (Configuration  *configuration,
-					    RWScreen       *screen);
+					    GnomeRRScreen       *screen);
 
 #endif

Modified: branches/randr-12/libgnome-desktop/libgnomeui/randrwrap.h
==============================================================================
--- branches/randr-12/libgnome-desktop/libgnomeui/randrwrap.h	(original)
+++ branches/randr-12/libgnome-desktop/libgnomeui/randrwrap.h	Tue Jun 10 17:31:07 2008
@@ -25,99 +25,99 @@
 #define RANDR_WRAP_H
 
 #ifndef GNOME_DESKTOP_USE_UNSTABLE_API
-#error    randrwrap is unstable API. You must define GNOME_DESKTOP_USE_UNSTABLE_API before including randrwrap.h
+#error    GnomeRR is unstable API. You must define GNOME_DESKTOP_USE_UNSTABLE_API before including gnomerr.h
 #endif
 
 #include <glib.h>
 #include <gdk/gdk.h>
 
-typedef struct RWScreen RWScreen;
-typedef struct RWOutput RWOutput;
-typedef struct RWCrtc RWCrtc;
-typedef struct RWMode RWMode;
+typedef struct GnomeRRScreen GnomeRRScreen;
+typedef struct GnomeRROutput GnomeRROutput;
+typedef struct GnomeRRCrtc GnomeRRCrtc;
+typedef struct GnomeRRMode GnomeRRMode;
 
-typedef void (* RWScreenChanged) (RWScreen *screen, gpointer data);
+typedef void (* GnomeRRScreenChanged) (GnomeRRScreen *screen, gpointer data);
 
 typedef enum
 {
-    RW_ROTATION_0 =	(1 << 0),
-    RW_ROTATION_90 =	(1 << 1),
-    RW_ROTATION_180 =	(1 << 2),
-    RW_ROTATION_270 =	(1 << 3),
-    RW_REFLECT_X =	(1 << 4),
-    RW_REFLECT_Y =	(1 << 5)
-} RWRotation;
-
-/* RWScreen */
-RWScreen *    rw_screen_new                (GdkScreen       *screen,
-					    RWScreenChanged  callback,
-					    gpointer         data);
-RWOutput **   rw_screen_list_outputs       (RWScreen        *screen);
-RWCrtc **     rw_screen_list_crtcs         (RWScreen        *screen);
-RWMode **     rw_screen_list_modes         (RWScreen        *screen);
-void          rw_screen_set_size           (RWScreen        *screen,
-					    int		     width,
-					    int              height,
-					    int              mm_width,
-					    int              mm_height);
-RWCrtc *      rw_screen_get_crtc_by_id     (RWScreen        *screen,
-					    guint32          id);
-gboolean      rw_screen_refresh            (RWScreen        *screen);
-RWOutput *    rw_screen_get_output_by_id   (RWScreen        *screen,
-					    guint32          id);
-RWOutput *    rw_screen_get_output_by_name (RWScreen        *screen,
-					    const char      *name);
-void	      rw_screen_get_ranges         (RWScreen	    *screen,
-					    int		    *min_width,
-					    int		    *max_width,
-					    int             *min_height,
-					    int		    *max_height);
-
-/* RWOutput */
-guint32       rw_output_get_id             (RWOutput        *output);
-const char *  rw_output_get_name           (RWOutput        *output);
-gboolean      rw_output_is_connected       (RWOutput        *output);
-int           rw_output_get_size_inches    (RWOutput        *output);
-int           rw_output_get_width_mm       (RWOutput        *outout);
-int           rw_output_get_height_mm      (RWOutput        *output);
-const guint8 *rw_output_get_edid_data      (RWOutput        *output);
-RWCrtc **     rw_output_get_possible_crtcs (RWOutput        *output);
-RWMode *      rw_output_get_current_mode   (RWOutput        *output);
-RWCrtc *      rw_output_get_crtc           (RWOutput        *output);
-void          rw_output_get_position       (RWOutput        *output,
-					    int             *x,
-					    int             *y);
-gboolean      rw_output_can_clone          (RWOutput        *output,
-					    RWOutput        *clone);
-RWMode **     rw_output_list_modes         (RWOutput        *output);
-RWMode *      rw_output_get_preferred_mode (RWOutput        *output);
-gboolean      rw_output_supports_mode      (RWOutput        *output,
-					    RWMode          *mode);
-
-/* RWMode */
-guint32	      rw_mode_get_id               (RWMode          *mode);
-guint	      rw_mode_get_width		   (RWMode          *mode);
-guint         rw_mode_get_height           (RWMode          *mode);
-int           rw_mode_get_freq             (RWMode          *mode);
-
-/* RWCrtc */
-guint32       rw_crtc_get_id               (RWCrtc          *crtc);
-gboolean      rw_crtc_set_config	   (RWCrtc          *crtc,
-					    int		     x,
-					    int		     y,
-					    RWMode	    *mode,
-					    RWRotation	     rotation,
-					    RWOutput	   **outputs,
-				  	    int              n_outputs);
-gboolean      rw_crtc_can_drive_output     (RWCrtc          *crtc,
-					    RWOutput        *output);
-RWMode *      rw_crtc_get_current_mode     (RWCrtc          *crtc);
-void          rw_crtc_get_position         (RWCrtc          *crtc,
-					    int             *x,
-					    int             *y);
-RWRotation    rw_crtc_get_current_rotation (RWCrtc          *crtc);
-RWRotation    rw_crtc_get_rotations        (RWCrtc          *crtc);
-gboolean      rw_crtc_supports_rotation    (RWCrtc	    *crtc,
-					    RWRotation	     rotation);
+    GNOME_RR_ROTATION_0 =	(1 << 0),
+    GNOME_RR_ROTATION_90 =	(1 << 1),
+    GNOME_RR_ROTATION_180 =	(1 << 2),
+    GNOME_RR_ROTATION_270 =	(1 << 3),
+    GNOME_RR_REFLECT_X =	(1 << 4),
+    GNOME_RR_REFLECT_Y =	(1 << 5)
+} GnomeRRRotation;
+
+/* GnomeRRScreen */
+GnomeRRScreen * gnome_rr_screen_new                (GdkScreen             *screen,
+						    GnomeRRScreenChanged   callback,
+						    gpointer               data);
+GnomeRROutput **gnome_rr_screen_list_outputs       (GnomeRRScreen         *screen);
+GnomeRRCrtc **  gnome_rr_screen_list_crtcs         (GnomeRRScreen         *screen);
+GnomeRRMode **  gnome_rr_screen_list_modes         (GnomeRRScreen         *screen);
+void            gnome_rr_screen_set_size           (GnomeRRScreen         *screen,
+						    int                    width,
+						    int                    height,
+						    int                    mm_width,
+						    int                    mm_height);
+GnomeRRCrtc *   gnome_rr_screen_get_crtc_by_id     (GnomeRRScreen         *screen,
+						    guint32                id);
+gboolean        gnome_rr_screen_refresh            (GnomeRRScreen         *screen);
+GnomeRROutput * gnome_rr_screen_get_output_by_id   (GnomeRRScreen         *screen,
+						    guint32                id);
+GnomeRROutput * gnome_rr_screen_get_output_by_name (GnomeRRScreen         *screen,
+						    const char            *name);
+void            gnome_rr_screen_get_ranges         (GnomeRRScreen         *screen,
+						    int                   *min_width,
+						    int                   *max_width,
+						    int                   *min_height,
+						    int                   *max_height);
+
+/* GnomeRROutput */
+guint32         gnome_rr_output_get_id             (GnomeRROutput         *output);
+const char *    gnome_rr_output_get_name           (GnomeRROutput         *output);
+gboolean        gnome_rr_output_is_connected       (GnomeRROutput         *output);
+int             gnome_rr_output_get_size_inches    (GnomeRROutput         *output);
+int             gnome_rr_output_get_width_mm       (GnomeRROutput         *outout);
+int             gnome_rr_output_get_height_mm      (GnomeRROutput         *output);
+const guint8 *  gnome_rr_output_get_edid_data      (GnomeRROutput         *output);
+GnomeRRCrtc **  gnome_rr_output_get_possible_crtcs (GnomeRROutput         *output);
+GnomeRRMode *   gnome_rr_output_get_current_mode   (GnomeRROutput         *output);
+GnomeRRCrtc *   gnome_rr_output_get_crtc           (GnomeRROutput         *output);
+void            gnome_rr_output_get_position       (GnomeRROutput         *output,
+						    int                   *x,
+						    int                   *y);
+gboolean        gnome_rr_output_can_clone          (GnomeRROutput         *output,
+						    GnomeRROutput         *clone);
+GnomeRRMode **  gnome_rr_output_list_modes         (GnomeRROutput         *output);
+GnomeRRMode *   gnome_rr_output_get_preferred_mode (GnomeRROutput         *output);
+gboolean        gnome_rr_output_supports_mode      (GnomeRROutput         *output,
+						    GnomeRRMode           *mode);
+
+/* GnomeRRMode */
+guint32         gnome_rr_mode_get_id               (GnomeRRMode           *mode);
+guint           gnome_rr_mode_get_width            (GnomeRRMode           *mode);
+guint           gnome_rr_mode_get_height           (GnomeRRMode           *mode);
+int             gnome_rr_mode_get_freq             (GnomeRRMode           *mode);
+
+/* GnomeRRCrtc */
+guint32         gnome_rr_crtc_get_id               (GnomeRRCrtc           *crtc);
+gboolean        gnome_rr_crtc_set_config           (GnomeRRCrtc           *crtc,
+						    int                    x,
+						    int                    y,
+						    GnomeRRMode           *mode,
+						    GnomeRRRotation        rotation,
+						    GnomeRROutput        **outputs,
+						    int                    n_outputs);
+gboolean        gnome_rr_crtc_can_drive_output     (GnomeRRCrtc           *crtc,
+						    GnomeRROutput         *output);
+GnomeRRMode *   gnome_rr_crtc_get_current_mode     (GnomeRRCrtc           *crtc);
+void            gnome_rr_crtc_get_position         (GnomeRRCrtc           *crtc,
+						    int                   *x,
+						    int                   *y);
+GnomeRRRotation gnome_rr_crtc_get_current_rotation (GnomeRRCrtc           *crtc);
+GnomeRRRotation gnome_rr_crtc_get_rotations        (GnomeRRCrtc           *crtc);
+gboolean        gnome_rr_crtc_supports_rotation    (GnomeRRCrtc           *crtc,
+						    GnomeRRRotation        rotation);
 
 #endif

Modified: branches/randr-12/libgnome-desktop/monitor-db.c
==============================================================================
--- branches/randr-12/libgnome-desktop/monitor-db.c	(original)
+++ branches/randr-12/libgnome-desktop/monitor-db.c	Tue Jun 10 17:31:07 2008
@@ -66,7 +66,7 @@
 typedef struct CrtcAssignment CrtcAssignment;
 
 static void            crtc_assignment_apply (CrtcAssignment *assign);
-static CrtcAssignment *crtc_assignment_new   (RWScreen       *screen,
+static CrtcAssignment *crtc_assignment_new   (GnomeRRScreen       *screen,
 					      Output        **outputs);
 static void            crtc_assignment_free  (CrtcAssignment *assign);
 static void            output_free           (Output         *output);
@@ -215,9 +215,9 @@
     
     if (strcmp (name, "output") == 0)
     {
-	/* If no rotation properties were set, just use RW_ROTATION_0 */
+	/* If no rotation properties were set, just use GNOME_RR_ROTATION_0 */
 	if (parser->output->rotation == 0)
-	    parser->output->rotation = RW_ROTATION_0;
+	    parser->output->rotation = GNOME_RR_ROTATION_0;
 	
 	g_ptr_array_add (parser->outputs, parser->output);
 
@@ -305,33 +305,33 @@
     {
 	if (strcmp (text, "normal") == 0)
 	{
-	    parser->output->rotation |= RW_ROTATION_0;
+	    parser->output->rotation |= GNOME_RR_ROTATION_0;
 	}
 	else if (strcmp (text, "left") == 0)
 	{
-	    parser->output->rotation |= RW_ROTATION_90;
+	    parser->output->rotation |= GNOME_RR_ROTATION_90;
 	}
 	else if (strcmp (text, "upside_down") == 0)
 	{
-	    parser->output->rotation |= RW_ROTATION_180;
+	    parser->output->rotation |= GNOME_RR_ROTATION_180;
 	}
 	else if (strcmp (text, "right") == 0)
 	{
-	    parser->output->rotation |= RW_ROTATION_270;
+	    parser->output->rotation |= GNOME_RR_ROTATION_270;
 	}
     }
     else if (stack_is (parser, "reflect_x", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
     {
 	if (strcmp (text, "yes") == 0)
 	{
-	    parser->output->rotation |= RW_REFLECT_X;
+	    parser->output->rotation |= GNOME_RR_REFLECT_X;
 	}
     }
     else if (stack_is (parser, "reflect_y", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
     {
 	if (strcmp (text, "yes") == 0)
 	{
-	    parser->output->rotation |= RW_REFLECT_Y;
+	    parser->output->rotation |= GNOME_RR_REFLECT_Y;
 	}
     }
     else
@@ -451,31 +451,31 @@
 }
 
 Configuration *
-configuration_new_current (RWScreen *screen)
+configuration_new_current (GnomeRRScreen *screen)
 {
     Configuration *config = g_new0 (Configuration, 1);
     GPtrArray *a = g_ptr_array_new ();
-    RWOutput **rw_outputs;
+    GnomeRROutput **gnome_rr_outputs;
     int i;
     int clone_width = -1;
     int clone_height = -1;
 
     g_return_val_if_fail (screen != NULL, NULL);
 
-    rw_outputs = rw_screen_list_outputs (screen);
+    gnome_rr_outputs = gnome_rr_screen_list_outputs (screen);
 
     config->clone = FALSE;
     
-    for (i = 0; rw_outputs[i] != NULL; ++i)
+    for (i = 0; gnome_rr_outputs[i] != NULL; ++i)
     {
-	RWOutput *rw_output = rw_outputs[i];
+	GnomeRROutput *gnome_rr_output = gnome_rr_outputs[i];
 	Output *output = g_new0 (Output, 1);
-	RWMode *mode = NULL;
-	const guint8 *edid_data = rw_output_get_edid_data (rw_output);
-	RWCrtc *crtc;
+	GnomeRRMode *mode = NULL;
+	const guint8 *edid_data = gnome_rr_output_get_edid_data (gnome_rr_output);
+	GnomeRRCrtc *crtc;
 
-	output->name = g_strdup (rw_output_get_name (rw_output));
-	output->connected = rw_output_is_connected (rw_output);
+	output->name = g_strdup (gnome_rr_output_get_name (gnome_rr_output));
+	output->connected = gnome_rr_output_is_connected (gnome_rr_output);
 
 	if (!output->connected)
 	{
@@ -484,7 +484,7 @@
 	    output->width = -1;
 	    output->height = -1;
 	    output->rate = -1;
-	    output->rotation = RW_ROTATION_0;
+	    output->rotation = GNOME_RR_ROTATION_0;
 	}
 	else
 	{
@@ -510,22 +510,22 @@
 	    }
 	    
 	    output->display_name = make_display_name (
-		rw_output_get_name (rw_output), info);
+		gnome_rr_output_get_name (gnome_rr_output), info);
 		
 	    g_free (info);
 		
-	    crtc = rw_output_get_crtc (rw_output);
-	    mode = crtc? rw_crtc_get_current_mode (crtc) : NULL;
+	    crtc = gnome_rr_output_get_crtc (gnome_rr_output);
+	    mode = crtc? gnome_rr_crtc_get_current_mode (crtc) : NULL;
 	    
 	    if (crtc && mode)
 	    {
 		output->on = TRUE;
 		
-		rw_crtc_get_position (crtc, &output->x, &output->y);
-		output->width = rw_mode_get_width (mode);
-		output->height = rw_mode_get_height (mode);
-		output->rate = rw_mode_get_freq (mode);
-		output->rotation = rw_crtc_get_current_rotation (crtc);
+		gnome_rr_crtc_get_position (crtc, &output->x, &output->y);
+		output->width = gnome_rr_mode_get_width (mode);
+		output->height = gnome_rr_mode_get_height (mode);
+		output->rate = gnome_rr_mode_get_freq (mode);
+		output->rotation = gnome_rr_crtc_get_current_rotation (crtc);
 
 		if (output->x == 0 && output->y == 0) {
 			if (clone_width == -1) {
@@ -544,11 +544,11 @@
 	    }
 
 	    /* Get preferred size for the monitor */
-	    mode = rw_output_get_preferred_mode (rw_output);
+	    mode = gnome_rr_output_get_preferred_mode (gnome_rr_output);
 	    
 	    if (!mode)
 	    {
-		RWMode **modes = rw_output_list_modes (rw_output);
+		GnomeRRMode **modes = gnome_rr_output_list_modes (gnome_rr_output);
 		
 		/* FIXME: we should pick the "best" mode here, where best is
 		 * sorted wrt
@@ -566,8 +566,8 @@
 	    
 	    if (mode)
 	    {
-		output->pref_width = rw_mode_get_width (mode);
-		output->pref_height = rw_mode_get_height (mode);
+		output->pref_width = gnome_rr_mode_get_width (mode);
+		output->pref_height = gnome_rr_mode_get_height (mode);
 	    }
 	    else
 	    {
@@ -786,7 +786,7 @@
 
 gboolean
 configuration_applicable (Configuration  *configuration,
-			  RWScreen       *screen)
+			  GnomeRRScreen       *screen)
 {
     Output **outputs = make_outputs (configuration);
     CrtcAssignment *assign = crtc_assignment_new (screen, outputs);
@@ -837,15 +837,15 @@
 }
 
 static const char *
-get_rotation_name (RWRotation r)
+get_rotation_name (GnomeRRRotation r)
 {
-    if (r & RW_ROTATION_0)
+    if (r & GNOME_RR_ROTATION_0)
 	return "normal";
-    if (r & RW_ROTATION_90)
+    if (r & GNOME_RR_ROTATION_90)
 	return "left";
-    if (r & RW_ROTATION_180)
+    if (r & GNOME_RR_ROTATION_180)
 	return "upside_down";
-    if (r & RW_ROTATION_270)
+    if (r & GNOME_RR_ROTATION_270)
 	return "right";
 
     return "normal";
@@ -858,15 +858,15 @@
 }
 
 static const char *
-get_reflect_x (RWRotation r)
+get_reflect_x (GnomeRRRotation r)
 {
-    return yes_no (r & RW_REFLECT_X);
+    return yes_no (r & GNOME_RR_REFLECT_X);
 }
 
 static const char *
-get_reflect_y (RWRotation r)
+get_reflect_y (GnomeRRRotation r)
 {
-    return yes_no (r & RW_REFLECT_Y);
+    return yes_no (r & GNOME_RR_REFLECT_Y);
 }
 
 static void
@@ -1004,7 +1004,7 @@
 }
 
 static gboolean
-apply_configuration (Configuration *conf, RWScreen *screen)
+apply_configuration (Configuration *conf, GnomeRRScreen *screen)
 {
     CrtcAssignment *assignment;
     Output **outputs;
@@ -1028,17 +1028,17 @@
 }
 
 gboolean
-configuration_apply_stored (RWScreen *screen)
+configuration_apply_stored (GnomeRRScreen *screen)
 {
     Configuration **configs = configurations_read (NULL); /* NULL-GError */
     Configuration *current;
     Configuration *found;
-    gboolean result;
+    gboolean result = TRUE;
 
     if (!screen)
 	return FALSE;
     
-    rw_screen_refresh (screen);
+    gnome_rr_screen_refresh (screen);
     
     current = configuration_new_current (screen);
     if (configs)
@@ -1069,30 +1069,30 @@
 
 struct CrtcInfo
 {
-    RWMode    *mode;
+    GnomeRRMode    *mode;
     int        x;
     int        y;
-    RWRotation rotation;
+    GnomeRRRotation rotation;
     GPtrArray *outputs;
 };
 
 struct CrtcAssignment
 {
-    RWScreen *screen;
+    GnomeRRScreen *screen;
     GHashTable *info;
 };
 
 static gboolean
 can_clone (CrtcInfo *info,
-	   RWOutput *output)
+	   GnomeRROutput *output)
 {
     int i;
 
     for (i = 0; i < info->outputs->len; ++i)
     {
-	RWOutput *clone = info->outputs->pdata[i];
+	GnomeRROutput *clone = info->outputs->pdata[i];
 
-	if (!rw_output_can_clone (clone, output))
+	if (!gnome_rr_output_can_clone (clone, output))
 	    return FALSE;
     }
 
@@ -1101,20 +1101,20 @@
 
 static gboolean
 crtc_assignment_assign (CrtcAssignment *assign,
-			RWCrtc         *crtc,
-			RWMode         *mode,
+			GnomeRRCrtc         *crtc,
+			GnomeRRMode         *mode,
 			int             x,
 			int             y,
-			RWRotation      rotation,
-			RWOutput       *output)
+			GnomeRRRotation      rotation,
+			GnomeRROutput       *output)
 {
     /* FIXME: We should reject stuff that is outside the screen ranges */
     
     CrtcInfo *info = g_hash_table_lookup (assign->info, crtc);
 
-    if (!rw_crtc_can_drive_output (crtc, output) ||
-	!rw_output_supports_mode (output, mode)  ||
-	!rw_crtc_supports_rotation (crtc, rotation))
+    if (!gnome_rr_crtc_can_drive_output (crtc, output) ||
+	!gnome_rr_output_supports_mode (output, mode)  ||
+	!gnome_rr_crtc_supports_rotation (crtc, rotation))
     {
 	return FALSE;
     }
@@ -1154,8 +1154,8 @@
 
 static void
 crtc_assignment_unassign (CrtcAssignment *assign,
-			  RWCrtc         *crtc,
-			  RWOutput       *output)
+			  GnomeRRCrtc         *crtc,
+			  GnomeRROutput       *output)
 {
     CrtcInfo *info = g_hash_table_lookup (assign->info, crtc);
 
@@ -1181,22 +1181,22 @@
 		gpointer value,
 		gpointer data)
 {
-    RWCrtc *crtc = key;
+    GnomeRRCrtc *crtc = key;
     CrtcInfo *info = value;
 
-    rw_crtc_set_config (crtc,
+    gnome_rr_crtc_set_config (crtc,
 			info->x, info->y,
 			info->mode,
 			info->rotation,
-			(RWOutput **)info->outputs->pdata,
+			(GnomeRROutput **)info->outputs->pdata,
 			info->outputs->len);
 }
 
 static gboolean
 mode_is_rotated (CrtcInfo *info)
 {
-    if ((info->rotation & RW_ROTATION_270)		||
-	(info->rotation & RW_ROTATION_90))
+    if ((info->rotation & GNOME_RR_ROTATION_270)		||
+	(info->rotation & GNOME_RR_ROTATION_90))
     {
 	return TRUE;
     }
@@ -1204,12 +1204,12 @@
 }
 
 static gboolean
-crtc_is_rotated (RWCrtc *crtc)
+crtc_is_rotated (GnomeRRCrtc *crtc)
 {
-    RWRotation r = rw_crtc_get_current_rotation (crtc);
+    GnomeRRRotation r = gnome_rr_crtc_get_current_rotation (crtc);
 
-    if ((r & RW_ROTATION_270)		||
-	(r & RW_ROTATION_90))
+    if ((r & GNOME_RR_ROTATION_270)		||
+	(r & GNOME_RR_ROTATION_90))
     {
 	return TRUE;
     }
@@ -1221,7 +1221,7 @@
 crtc_assignment_apply (CrtcAssignment *assign)
 {
     GList *active_crtcs = g_hash_table_get_keys (assign->info);
-    RWCrtc **all_crtcs = rw_screen_list_crtcs (assign->screen);
+    GnomeRRCrtc **all_crtcs = gnome_rr_screen_list_crtcs (assign->screen);
     GList *list;
     int width, height;
     int i;
@@ -1232,12 +1232,12 @@
     width = height = 1;
     for (list = active_crtcs; list != NULL; list = list->next)
     {
-	RWCrtc *crtc = list->data;
+	GnomeRRCrtc *crtc = list->data;
 	CrtcInfo *info = g_hash_table_lookup (assign->info, crtc);
 	int w, h;
 
-	w = rw_mode_get_width (info->mode);
-	h = rw_mode_get_height (info->mode);
+	w = gnome_rr_mode_get_width (info->mode);
+	h = gnome_rr_mode_get_height (info->mode);
 	
 	if (mode_is_rotated (info))
 	{
@@ -1251,7 +1251,7 @@
     }
     g_list_free (active_crtcs);
 
-    rw_screen_get_ranges (
+    gnome_rr_screen_get_ranges (
 	assign->screen, &min_width, &max_width, &min_height, &max_height);
 
     width = MAX (min_width, width);
@@ -1262,17 +1262,17 @@
     /* Turn off all crtcs currently displaying outside the new screen */
     for (i = 0; all_crtcs[i] != NULL; ++i)
     {
-	RWCrtc *crtc = all_crtcs[i];
-	RWMode *mode = rw_crtc_get_current_mode (crtc);
+	GnomeRRCrtc *crtc = all_crtcs[i];
+	GnomeRRMode *mode = gnome_rr_crtc_get_current_mode (crtc);
 	int x, y;
 
 	if (mode)
 	{
 	    int w, h;
-	    rw_crtc_get_position (crtc, &x, &y);
+	    gnome_rr_crtc_get_position (crtc, &x, &y);
 
-	    w = rw_mode_get_width (mode);
-	    h = rw_mode_get_height (mode);
+	    w = gnome_rr_mode_get_width (mode);
+	    h = gnome_rr_mode_get_height (mode);
 	    
 	    if (crtc_is_rotated (crtc))
 	    {
@@ -1282,17 +1282,17 @@
 	    }
 	    
 	    if (x + w > width || y + h > height)
-		rw_crtc_set_config (crtc, 0, 0, NULL, RW_ROTATION_0, NULL, 0);
+		gnome_rr_crtc_set_config (crtc, 0, 0, NULL, GNOME_RR_ROTATION_0, NULL, 0);
 	}
     }
 
     /* Turn off all CRTC's that are not in the assignment */
     for (i = 0; all_crtcs[i] != NULL; ++i)
     {
-	RWCrtc *crtc = all_crtcs[i];
+	GnomeRRCrtc *crtc = all_crtcs[i];
 	
 	if (!g_hash_table_lookup (assign->info, crtc))
-	    rw_crtc_set_config (crtc, 0, 0, NULL, RW_ROTATION_0, NULL, 0);
+	    gnome_rr_crtc_set_config (crtc, 0, 0, NULL, GNOME_RR_ROTATION_0, NULL, 0);
     }
 
     /* The 'physical size' of an X screen is meaningless if that screen
@@ -1304,7 +1304,7 @@
     width_mm = (width / 96.0) * 25.4 + 0.5;
     height_mm = (height / 96.0) * 25.4 + 0.5;
     
-    rw_screen_set_size (assign->screen, width, height, width_mm, height_mm);
+    gnome_rr_screen_set_size (assign->screen, width, height, width_mm, height_mm);
 
     g_hash_table_foreach (assign->info, configure_crtc, NULL);
 }
@@ -1317,11 +1317,11 @@
  * enough that it doesn't matter.
  */
 static gboolean
-real_assign_crtcs (RWScreen *screen,
+real_assign_crtcs (GnomeRRScreen *screen,
 		   Output **outputs,
 		   CrtcAssignment *assignment)
 {
-    RWCrtc **crtcs = rw_screen_list_crtcs (screen);
+    GnomeRRCrtc **crtcs = gnome_rr_screen_list_crtcs (screen);
     Output *output;
     int i;
 
@@ -1344,29 +1344,29 @@
 	 */
 	for (pass = 0; pass < 2; ++pass)
 	{
-	    RWCrtc *crtc = crtcs[i];
-	    RWOutput *rw_output = rw_screen_get_output_by_name (screen, output->name);
-	    RWMode **modes = rw_output_list_modes (rw_output);
+	    GnomeRRCrtc *crtc = crtcs[i];
+	    GnomeRROutput *gnome_rr_output = gnome_rr_screen_get_output_by_name (screen, output->name);
+	    GnomeRRMode **modes = gnome_rr_output_list_modes (gnome_rr_output);
 	    int j;
 	
 	    for (j = 0; modes[j] != NULL; ++j)
 	    {
-		RWMode *mode = modes[j];
+		GnomeRRMode *mode = modes[j];
 		
-		if (rw_mode_get_width (mode) == output->width	&&
-		    rw_mode_get_height (mode) == output->height &&
-		    (pass == 1 || rw_mode_get_freq (mode) == output->rate))
+		if (gnome_rr_mode_get_width (mode) == output->width	&&
+		    gnome_rr_mode_get_height (mode) == output->height &&
+		    (pass == 1 || gnome_rr_mode_get_freq (mode) == output->rate))
 		{
 		    if (crtc_assignment_assign (
 			    assignment, crtc, modes[j],
 			    output->x, output->y,
 			    output->rotation,
-			    rw_output))
+			    gnome_rr_output))
 		    {
 			if (real_assign_crtcs (screen, outputs + 1, assignment))
 			    return TRUE;
 			
-			crtc_assignment_unassign (assignment, crtc, rw_output);
+			crtc_assignment_unassign (assignment, crtc, gnome_rr_output);
 		    }
 		}
 	    }
@@ -1384,7 +1384,7 @@
 }
 
 static CrtcAssignment *
-crtc_assignment_new (RWScreen *screen, Output **outputs)
+crtc_assignment_new (GnomeRRScreen *screen, Output **outputs)
 {
     CrtcAssignment *assignment = g_new0 (CrtcAssignment, 1);
 

Modified: branches/randr-12/libgnome-desktop/randrwrap.c
==============================================================================
--- branches/randr-12/libgnome-desktop/randrwrap.c	(original)
+++ branches/randr-12/libgnome-desktop/randrwrap.c	Tue Jun 10 17:31:07 2008
@@ -45,66 +45,66 @@
 
     XRRScreenResources *resources;
     
-    RWOutput **		outputs;
-    RWCrtc **		crtcs;
-    RWMode **		modes;
-
-    RWScreen *		screen;
+    GnomeRROutput **	outputs;
+    GnomeRRCrtc **	crtcs;
+    GnomeRRMode **	modes;
+    
+    GnomeRRScreen *	screen;
 };
 
-struct RWScreen
+struct GnomeRRScreen
 {
-    GdkScreen *		gdk_screen;
-    GdkWindow *		gdk_root;
-    Display *		xdisplay;
-    Screen *		xscreen;
-    Window		xroot;
-    ScreenInfo *	info;
-   
-    int			randr_event_base;
-
-    RWScreenChanged	callback;
-    gpointer		data;
+    GdkScreen *			gdk_screen;
+    GdkWindow *			gdk_root;
+    Display *			xdisplay;
+    Screen *			xscreen;
+    Window			xroot;
+    ScreenInfo *		info;
+    
+    int				randr_event_base;
+    
+    GnomeRRScreenChanged	callback;
+    gpointer			data;
 };
 
-struct RWOutput
+struct GnomeRROutput
 {
     ScreenInfo *	info;
     RROutput		id;
     
     char *		name;
-    RWCrtc *		current_crtc;
+    GnomeRRCrtc *	current_crtc;
     gboolean		connected;
     gulong		width_mm;
     gulong		height_mm;
-    RWCrtc **		possible_crtcs;
-    RWOutput **		clones;
-    RWMode **		modes;
+    GnomeRRCrtc **	possible_crtcs;
+    GnomeRROutput **	clones;
+    GnomeRRMode **	modes;
     int			n_preferred;
     guint8 *		edid_data;
 };
 
-struct RWOutputWrap
+struct GnomeRROutputWrap
 {
     RROutput		id;
 };
 
-struct RWCrtc
+struct GnomeRRCrtc
 {
     ScreenInfo *	info;
     RRCrtc		id;
     
-    RWMode *		current_mode;
-    RWOutput **		current_outputs;
-    RWOutput **		possible_outputs;
+    GnomeRRMode *	current_mode;
+    GnomeRROutput **	current_outputs;
+    GnomeRROutput **	possible_outputs;
     int			x;
     int			y;
-
-    RWRotation		current_rotation;
-    RWRotation		rotations;
+    
+    GnomeRRRotation	current_rotation;
+    GnomeRRRotation	rotations;
 };
 
-struct RWMode
+struct GnomeRRMode
 {
     ScreenInfo *	info;
     RRMode		id;
@@ -114,38 +114,36 @@
     int			freq;		/* in mHz */
 };
 
-/* RWCrtc */
-static RWCrtc *  crtc_new             (ScreenInfo         *info,
-				       RRCrtc              id);
-static void      crtc_free            (RWCrtc             *crtc);
-static void      crtc_initialize      (RWCrtc             *crtc,
-				       XRRScreenResources *res);
-
-
-/* RWOutput */
-static RWOutput *output_new           (ScreenInfo         *info,
-				       RROutput            id);
-static void      output_initialize    (RWOutput           *output,
-				       XRRScreenResources *res);
-static void      output_free          (RWOutput           *output);
-
-
-/* RWMode */
-static RWMode *  mode_new             (ScreenInfo         *info,
-				       RRMode              id);
-static void      mode_initialize      (RWMode             *mode,
-				       XRRModeInfo        *info);
-static void      mode_free            (RWMode             *mode);
+/* GnomeRRCrtc */
+static GnomeRRCrtc *  crtc_new          (ScreenInfo         *info,
+					 RRCrtc              id);
+static void           crtc_free         (GnomeRRCrtc        *crtc);
+static void           crtc_initialize   (GnomeRRCrtc        *crtc,
+					 XRRScreenResources *res);
+
+/* GnomeRROutput */
+static GnomeRROutput *output_new        (ScreenInfo         *info,
+					 RROutput            id);
+static void           output_initialize (GnomeRROutput      *output,
+					 XRRScreenResources *res);
+static void           output_free       (GnomeRROutput      *output);
+
+/* GnomeRRMode */
+static GnomeRRMode *  mode_new          (ScreenInfo         *info,
+					 RRMode              id);
+static void           mode_initialize   (GnomeRRMode        *mode,
+					 XRRModeInfo        *info);
+static void           mode_free         (GnomeRRMode        *mode);
 
 
 /* Screen */
-static RWOutput *
-rw_output_by_id (ScreenInfo *info, RROutput id)
+static GnomeRROutput *
+gnome_rr_output_by_id (ScreenInfo *info, RROutput id)
 {
-    RWOutput **output;
-
+    GnomeRROutput **output;
+    
     g_assert (info != NULL);
-
+    
     for (output = info->outputs; *output; ++output)
     {
 	if ((*output)->id == id)
@@ -155,14 +153,14 @@
     return NULL;
 }
 
-static RWCrtc *
+static GnomeRRCrtc *
 crtc_by_id (ScreenInfo *info, RRCrtc id)
 {
-    RWCrtc **crtc;
-
+    GnomeRRCrtc **crtc;
+    
     if (!info)
         return NULL;
-
+    
     for (crtc = info->crtcs; *crtc; ++crtc)
     {
 	if ((*crtc)->id == id)
@@ -172,13 +170,13 @@
     return NULL;
 }
 
-static RWMode *
+static GnomeRRMode *
 mode_by_id (ScreenInfo *info, RRMode id)
 {
-    RWMode **mode;
-
+    GnomeRRMode **mode;
+    
     g_assert (info != NULL);
-
+    
     for (mode = info->modes; *mode; ++mode)
     {
 	if ((*mode)->id == id)
@@ -191,16 +189,16 @@
 static void
 screen_info_free (ScreenInfo *info)
 {
-    RWOutput **output;
-    RWCrtc **crtc;
-    RWMode **mode;
-
+    GnomeRROutput **output;
+    GnomeRRCrtc **crtc;
+    GnomeRRMode **mode;
+    
     g_assert (info != NULL);
-
+    
     if (info->resources)
     {
 	XRRFreeScreenResources (info->resources);
-
+	
 	info->resources = NULL;
     }
     
@@ -224,19 +222,20 @@
 	    mode_free (*mode);
 	g_free (info->modes);
     }
-
+    
     g_free (info);
 }
 
 static gboolean
-fill_out_screen_info (Display *xdisplay, Window xroot,
+fill_out_screen_info (Display *xdisplay,
+		      Window xroot,
 		      ScreenInfo *info)
 {
     XRRScreenResources *resources;
-
+    
     g_assert (xdisplay != NULL);
     g_assert (info != NULL);
-
+    
     gdk_error_trap_push ();
     
     if (!XRRGetScreenSizeRange (xdisplay, xroot,
@@ -254,7 +253,7 @@
         /* Unhandled X Error was generated */
         return False;
     }
-
+    
 #if 0
     g_print ("ranges: %d - %d; %d - %d\n",
 	     screen->min_width, screen->max_width,
@@ -262,14 +261,14 @@
 #endif
     
     resources = XRRGetScreenResources (xdisplay, xroot);
-
+    
     if (resources)
     {
 	int i;
 	GPtrArray *a;
-	RWCrtc **crtc;
-	RWOutput **output;
-
+	GnomeRRCrtc **crtc;
+	GnomeRROutput **output;
+	
 #if 0
 	g_print ("Resource Timestamp: %u\n", (guint32)resources->timestamp);
 	g_print ("Resource Configuration Timestamp: %u\n", (guint32)resources->configTimestamp);
@@ -283,32 +282,32 @@
 	a = g_ptr_array_new ();
 	for (i = 0; i < resources->ncrtc; ++i)
 	{
-	    RWCrtc *crtc = crtc_new (info, resources->crtcs[i]);
+	    GnomeRRCrtc *crtc = crtc_new (info, resources->crtcs[i]);
 	    
 	    g_ptr_array_add (a, crtc);
 	}
 	g_ptr_array_add (a, NULL);
-	info->crtcs = (RWCrtc **)g_ptr_array_free (a, FALSE);
+	info->crtcs = (GnomeRRCrtc **)g_ptr_array_free (a, FALSE);
 	
 	a = g_ptr_array_new ();
 	for (i = 0; i < resources->noutput; ++i)
 	{
-	    RWOutput *output = output_new (info, resources->outputs[i]);
+	    GnomeRROutput *output = output_new (info, resources->outputs[i]);
 	    
 	    g_ptr_array_add (a, output);
 	}
 	g_ptr_array_add (a, NULL);
-	info->outputs = (RWOutput **)g_ptr_array_free (a, FALSE);
+	info->outputs = (GnomeRROutput **)g_ptr_array_free (a, FALSE);
 	
 	a = g_ptr_array_new ();
 	for (i = 0;  i < resources->nmode; ++i)
 	{
-	    RWMode *mode = mode_new (info, resources->modes[i].id);
+	    GnomeRRMode *mode = mode_new (info, resources->modes[i].id);
 	    
 	    g_ptr_array_add (a, mode);
 	}
 	g_ptr_array_add (a, NULL);
-	info->modes = (RWMode **)g_ptr_array_free (a, FALSE);
+	info->modes = (GnomeRRMode **)g_ptr_array_free (a, FALSE);
 	
 	/* Initialize */
 	for (crtc = info->crtcs; *crtc; ++crtc)
@@ -319,34 +318,33 @@
 	
 	for (i = 0; i < resources->nmode; ++i)
 	{
-	    RWMode *mode = mode_by_id (info, resources->modes[i].id);
+	    GnomeRRMode *mode = mode_by_id (info, resources->modes[i].id);
 	    
 	    mode_initialize (mode, &(resources->modes[i]));
 	}
-
+	
 	return TRUE;
     }
     else
     {
 	g_print ("Couldn't get screen resources\n");
-
+	
 	return FALSE;
     }
 }
 
 static ScreenInfo *
-screen_info_new (RWScreen *screen)
+screen_info_new (GnomeRRScreen *screen)
 {
     ScreenInfo *info = g_new0 (ScreenInfo, 1);
-    RWOutput **o;
-
+    
     g_assert (screen != NULL);
-
+    
     info->outputs = NULL;
     info->crtcs = NULL;
     info->modes = NULL;
     info->screen = screen;
-
+    
     if (fill_out_screen_info (screen->xdisplay, screen->xroot, info))
     {
 	return info;
@@ -356,22 +354,16 @@
 	g_free (info);
 	return NULL;
     }
-
-    for (o = info->outputs; *o; o++)
-    {
-	
-    }
-    
 }
 
 static gboolean
-screen_update (RWScreen *screen, gboolean force_callback)
+screen_update (GnomeRRScreen *screen, gboolean force_callback)
 {
     ScreenInfo *info;
     gboolean changed = FALSE;
     
     g_assert (screen != NULL);
-
+    
     info = screen_info_new (screen);
     if (info)
     {
@@ -385,7 +377,7 @@
     
     if ((changed || force_callback) && screen->callback)
 	screen->callback (screen, screen->data);
-
+    
     return changed;
 }
 
@@ -394,13 +386,13 @@
 		 GdkEvent *event,
 		 gpointer data)
 {
-    RWScreen *screen = data;
+    GnomeRRScreen *screen = data;
     XEvent *e = xevent;
     
     if (e && e->type - screen->randr_event_base == RRNotify)
     {
 	XRRNotifyEvent *event = (XRRNotifyEvent *)e;
-
+	
 	switch (event->subtype)
 	{
 	default:
@@ -417,13 +409,13 @@
     return GDK_FILTER_CONTINUE;
 }
 
-/* Returns NULL if screen could not be created.  For instance, if driver
- * does not support Xrandr 1.2.
+/* Returns NULL if screen could not be created.  For instance, if
+ * the driver does not support Xrandr 1.2.
  */
-RWScreen *
-rw_screen_new (GdkScreen *gdk_screen,
-	       RWScreenChanged callback,
-	       gpointer data)
+GnomeRRScreen *
+gnome_rr_screen_new (GdkScreen *gdk_screen,
+		     GnomeRRScreenChanged callback,
+		     gpointer data)
 {
     Display *dpy = GDK_SCREEN_XDISPLAY (gdk_screen);
     int event_base;
@@ -431,21 +423,21 @@
     
     if (XRRQueryExtension (dpy, &event_base, &ignore))
     {
-	RWScreen *screen = g_new0 (RWScreen, 1);
-
+	GnomeRRScreen *screen = g_new0 (GnomeRRScreen, 1);
+	
 	screen->gdk_screen = gdk_screen;
 	screen->gdk_root = gdk_screen_get_root_window (gdk_screen);
 	screen->xroot = gdk_x11_drawable_get_xid (screen->gdk_root);
 	screen->xdisplay = dpy;
 	screen->xscreen = gdk_x11_screen_get_xscreen (screen->gdk_screen);
-
+	
 	screen->callback = callback;
 	screen->data = data;
 	
 	screen->randr_event_base = event_base;
-
+	
 	screen->info = screen_info_new (screen);
-
+	
 	if (!screen->info)
 	    return NULL;
 	
@@ -459,7 +451,7 @@
 	    gdk_screen_get_display (gdk_screen),
 	    event_base,
 	    RRNotify + 1);
-
+	
 	gdk_window_add_filter (screen->gdk_root, screen_on_event, screen);
 	return screen;
     }
@@ -468,11 +460,11 @@
 }
 
 void
-rw_screen_set_size (RWScreen *screen,
-		    int	      width,
-		    int       height,
-		    int       mm_width,
-		    int       mm_height)
+gnome_rr_screen_set_size (GnomeRRScreen *screen,
+			  int	      width,
+			  int       height,
+			  int       mm_width,
+			  int       mm_height)
 {
     g_return_if_fail (screen != NULL);
     
@@ -481,102 +473,102 @@
 }
 
 void
-rw_screen_get_ranges (RWScreen	*screen,
-		      int	*min_width,
-		      int	*max_width,
-		      int       *min_height,
-		      int	*max_height)
+gnome_rr_screen_get_ranges (GnomeRRScreen *screen,
+			    int	          *min_width,
+			    int	          *max_width,
+			    int           *min_height,
+			    int	          *max_height)
 {
     g_return_if_fail (screen != NULL);
-
+    
     if (min_width)
 	*min_width = screen->info->min_width;
-
+    
     if (max_width)
 	*max_width = screen->info->max_width;
-
+    
     if (min_height)
 	*min_height = screen->info->min_height;
-
+    
     if (max_height)
 	*max_height = screen->info->max_height;
 }
 
 gboolean
-rw_screen_refresh (RWScreen *screen)
+gnome_rr_screen_refresh (GnomeRRScreen *screen)
 {
     return screen_update (screen, FALSE);
 }
 
-RWMode **
-rw_screen_list_modes (RWScreen *screen)
+GnomeRRMode **
+gnome_rr_screen_list_modes (GnomeRRScreen *screen)
 {
     g_return_val_if_fail (screen != NULL, NULL);
     g_return_val_if_fail (screen->info != NULL, NULL);
-
+    
     return screen->info->modes;
 }
 
-RWCrtc **
-rw_screen_list_crtcs (RWScreen *screen)
+GnomeRRCrtc **
+gnome_rr_screen_list_crtcs (GnomeRRScreen *screen)
 {
     g_return_val_if_fail (screen != NULL, NULL);
     g_return_val_if_fail (screen->info != NULL, NULL);
-
+    
     return screen->info->crtcs;
 }
 
-RWOutput **
-rw_screen_list_outputs (RWScreen *screen)
+GnomeRROutput **
+gnome_rr_screen_list_outputs (GnomeRRScreen *screen)
 {
     g_return_val_if_fail (screen != NULL, NULL);
     g_return_val_if_fail (screen->info != NULL, NULL);
-
+    
     return screen->info->outputs;
 }
 
-RWCrtc *
-rw_screen_get_crtc_by_id (RWScreen *screen,
-			  guint32   id)
+GnomeRRCrtc *
+gnome_rr_screen_get_crtc_by_id (GnomeRRScreen *screen,
+				guint32        id)
 {
     int i;
-
+    
     g_return_val_if_fail (screen != NULL, NULL);
     g_return_val_if_fail (screen->info != NULL, NULL);
-
+    
     for (i = 0; screen->info->crtcs[i] != NULL; ++i)
     {
 	if (screen->info->crtcs[i]->id == id)
 	    return screen->info->crtcs[i];
     }
-
+    
     return NULL;
 }
 
-RWOutput *
-rw_screen_get_output_by_id (RWScreen *screen,
-			    guint32 id)
+GnomeRROutput *
+gnome_rr_screen_get_output_by_id (GnomeRRScreen *screen,
+				  guint32        id)
 {
     int i;
-
+    
     g_return_val_if_fail (screen != NULL, NULL);
     g_return_val_if_fail (screen->info != NULL, NULL);
-
+    
     for (i = 0; screen->info->outputs[i] != NULL; ++i)
     {
 	if (screen->info->outputs[i]->id == id)
 	    return screen->info->outputs[i];
     }
-
+    
     return NULL;
 }
 
-/* RWOutput */
-static RWOutput *
+/* GnomeRROutput */
+static GnomeRROutput *
 output_new (ScreenInfo *info, RROutput id)
 {
-    RWOutput *output = g_new0 (RWOutput, 1);
-
+    GnomeRROutput *output = g_new0 (GnomeRROutput, 1);
+    
     output->id = id;
     output->info = info;
     
@@ -611,22 +603,22 @@
     {
 	result = NULL;
     }
-
+    
     XFree (prop);
-
+    
     return result;
 }
 
 static guint8 *
-read_edid_data (RWOutput *output)
+read_edid_data (GnomeRROutput *output)
 {
     Atom edid_atom = XInternAtom (DISPLAY (output), "EDID_DATA", FALSE);
     guint8 *result;
     int len;
-
+    
     result = get_property (DISPLAY (output),
 			   output->id, edid_atom, &len);
-
+    
     if (result)
     {
 	if (len == 128)
@@ -634,12 +626,12 @@
 	else
 	    g_free (result);
     }
-
+    
     return NULL;
 }
 
 static void
-output_initialize (RWOutput *output, XRRScreenResources *res)
+output_initialize (GnomeRROutput *output, XRRScreenResources *res)
 {
     XRROutputInfo *info = XRRGetOutputInfo (
 	DISPLAY (output), res, output->id);
@@ -647,7 +639,7 @@
     int i;
     
     g_print ("Output %lx Timestamp: %u\n", output->id, (guint32)info->timestamp);
-	
+    
     if (!info || !output->info)
     {
 	/* FIXME */
@@ -665,38 +657,38 @@
     
     for (i = 0; i < info->ncrtc; ++i)
     {
-	RWCrtc *crtc = crtc_by_id (output->info, info->crtcs[i]);
+	GnomeRRCrtc *crtc = crtc_by_id (output->info, info->crtcs[i]);
 	
 	if (crtc)
 	    g_ptr_array_add (a, crtc);
     }
     g_ptr_array_add (a, NULL);
-    output->possible_crtcs = (RWCrtc **)g_ptr_array_free (a, FALSE);
+    output->possible_crtcs = (GnomeRRCrtc **)g_ptr_array_free (a, FALSE);
     
     /* Clones */
     a = g_ptr_array_new ();
     for (i = 0; i < info->nclone; ++i)
     {
-	RWOutput *rw_output = rw_output_by_id (output->info, info->clones[i]);
+	GnomeRROutput *gnome_rr_output = gnome_rr_output_by_id (output->info, info->clones[i]);
 	
-	if (rw_output)
-	    g_ptr_array_add (a, rw_output);
+	if (gnome_rr_output)
+	    g_ptr_array_add (a, gnome_rr_output);
     }
     g_ptr_array_add (a, NULL);
-    output->clones = (RWOutput **)g_ptr_array_free (a, FALSE);
+    output->clones = (GnomeRROutput **)g_ptr_array_free (a, FALSE);
     
     /* Modes */
     a = g_ptr_array_new ();
     for (i = 0; i < info->nmode; ++i)
     {
-	RWMode *mode = mode_by_id (output->info, info->modes[i]);
+	GnomeRRMode *mode = mode_by_id (output->info, info->modes[i]);
 	
 	if (mode)
 	    g_ptr_array_add (a, mode);
     }
     g_ptr_array_add (a, NULL);
-    output->modes = (RWMode **)g_ptr_array_free (a, FALSE);
-
+    output->modes = (GnomeRRMode **)g_ptr_array_free (a, FALSE);
+    
     output->n_preferred = info->npreferred;
     
     /* Edid data */
@@ -706,224 +698,225 @@
 }
 
 static void
-output_free (RWOutput *output)
+output_free (GnomeRROutput *output)
 {
     g_free (output);
 }
 
 guint32
-rw_output_get_id (RWOutput *output)
+gnome_rr_output_get_id (GnomeRROutput *output)
 {
     g_assert(output != NULL);
-
+    
     return output->id;
 }
 
 const guint8 *
-rw_output_get_edid_data (RWOutput *output)
+gnome_rr_output_get_edid_data (GnomeRROutput *output)
 {
     g_return_val_if_fail (output != NULL, NULL);
-
+    
     return output->edid_data;
 }
 
-RWOutput *
-rw_screen_get_output_by_name (RWScreen        *screen,
-			      const char      *name)
+GnomeRROutput *
+gnome_rr_screen_get_output_by_name (GnomeRRScreen *screen,
+				    const char    *name)
 {
     int i;
-
+    
     g_return_val_if_fail (screen != NULL, NULL);
     g_return_val_if_fail (screen->info != NULL, NULL);
-
+    
     for (i = 0; screen->info->outputs[i] != NULL; ++i)
     {
-	RWOutput *output = screen->info->outputs[i];
-
+	GnomeRROutput *output = screen->info->outputs[i];
+	
 	if (strcmp (output->name, name) == 0)
 	    return output;
     }
-
+    
     return NULL;
 }
 
-RWCrtc *
-rw_output_get_crtc (RWOutput *output)
+GnomeRRCrtc *
+gnome_rr_output_get_crtc (GnomeRROutput *output)
 {
     g_return_val_if_fail (output != NULL, NULL);
-
+    
     return output->current_crtc;
 }
 
-RWMode *
-rw_output_get_current_mode (RWOutput *output)
+GnomeRRMode *
+gnome_rr_output_get_current_mode (GnomeRROutput *output)
 {
-    RWCrtc *crtc;
-
+    GnomeRRCrtc *crtc;
+    
     g_return_val_if_fail (output != NULL, NULL);
-
-    if ((crtc = rw_output_get_crtc (output)))
-	return rw_crtc_get_current_mode (crtc);
-
+    
+    if ((crtc = gnome_rr_output_get_crtc (output)))
+	return gnome_rr_crtc_get_current_mode (crtc);
+    
     return NULL;
 }
 
 void
-rw_output_get_position (RWOutput        *output,
-			int             *x,
-			int             *y)
+gnome_rr_output_get_position (GnomeRROutput   *output,
+			      int             *x,
+			      int             *y)
 {
-    RWCrtc *crtc;
-
+    GnomeRRCrtc *crtc;
+    
     g_return_if_fail (output != NULL);
-
-    if ((crtc = rw_output_get_crtc (output)))
-	rw_crtc_get_position (crtc, x, y);
+    
+    if ((crtc = gnome_rr_output_get_crtc (output)))
+	gnome_rr_crtc_get_position (crtc, x, y);
 }
 
 const char *
-rw_output_get_name (RWOutput *output)
+gnome_rr_output_get_name (GnomeRROutput *output)
 {
     g_assert (output != NULL);
     return output->name;
 }
 
 int
-rw_output_get_width_mm (RWOutput *output)
+gnome_rr_output_get_width_mm (GnomeRROutput *output)
 {
     g_assert (output != NULL);
     return output->width_mm;
 }
 
 int
-rw_output_get_height_mm (RWOutput *output)
+gnome_rr_output_get_height_mm (GnomeRROutput *output)
 {
     g_assert (output != NULL);
     return output->height_mm;
 }
 
-RWMode *
-rw_output_get_preferred_mode (RWOutput *output)
+GnomeRRMode *
+gnome_rr_output_get_preferred_mode (GnomeRROutput *output)
 {
     g_return_val_if_fail (output != NULL, NULL);
     if (output->n_preferred)
 	return output->modes[0];
-
+    
     return NULL;
 }
 
-RWMode **
-rw_output_list_modes (RWOutput *output)
+GnomeRRMode **
+gnome_rr_output_list_modes (GnomeRROutput *output)
 {
     g_return_val_if_fail (output != NULL, NULL);
     return output->modes;
 }
 
 gboolean
-rw_output_is_connected (RWOutput *output)
+gnome_rr_output_is_connected (GnomeRROutput *output)
 {
     g_return_val_if_fail (output != NULL, FALSE);
     return output->connected;
 }
 
 gboolean
-rw_output_supports_mode (RWOutput *output,
-			 RWMode   *mode)
+gnome_rr_output_supports_mode (GnomeRROutput *output,
+			       GnomeRRMode   *mode)
 {
     int i;
-
+    
     g_return_val_if_fail (output != NULL, FALSE);
     g_return_val_if_fail (mode != NULL, FALSE);
-
+    
     for (i = 0; output->modes[i] != NULL; ++i)
     {
 	if (output->modes[i] == mode)
 	    return TRUE;
     }
-
+    
     return FALSE;
 }
 
 gboolean
-rw_output_can_clone (RWOutput *output,
-		     RWOutput *clone)
+gnome_rr_output_can_clone (GnomeRROutput *output,
+			   GnomeRROutput *clone)
 {
     int i;
-
+    
     g_return_val_if_fail (output != NULL, FALSE);
     g_return_val_if_fail (clone != NULL, FALSE);
-
+    
     for (i = 0; output->clones[i] != NULL; ++i)
     {
 	if (output->clones[i] == clone)
 	    return TRUE;
     }
-
+    
     return FALSE;
 }
 
-/* RWCrtc */
+/* GnomeRRCrtc */
 typedef struct
 {
     Rotation xrot;
-    RWRotation rot;
+    GnomeRRRotation rot;
 } RotationMap;
+
 static const RotationMap rotation_map[] =
 {
-    { RR_Rotate_0, RW_ROTATION_0 },
-    { RR_Rotate_90, RW_ROTATION_90 },
-    { RR_Rotate_180, RW_ROTATION_180 },
-    { RR_Rotate_270, RW_ROTATION_270 },
-    { RR_Reflect_X, RW_REFLECT_X },
-    { RR_Reflect_Y, RW_REFLECT_Y },
+    { RR_Rotate_0, GNOME_RR_ROTATION_0 },
+    { RR_Rotate_90, GNOME_RR_ROTATION_90 },
+    { RR_Rotate_180, GNOME_RR_ROTATION_180 },
+    { RR_Rotate_270, GNOME_RR_ROTATION_270 },
+    { RR_Reflect_X, GNOME_RR_REFLECT_X },
+    { RR_Reflect_Y, GNOME_RR_REFLECT_Y },
 };
 
-static RWRotation
-rw_rotation_from_xrotation (Rotation r)
+static GnomeRRRotation
+gnome_rr_rotation_from_xrotation (Rotation r)
 {
     int i;
-    RWRotation result = 0;
-
+    GnomeRRRotation result = 0;
+    
     for (i = 0; i < G_N_ELEMENTS (rotation_map); ++i)
     {
 	if (r & rotation_map[i].xrot)
 	    result |= rotation_map[i].rot;
     }
-
+    
     return result;
 }
 
 static Rotation
-xrotation_from_rotation (RWRotation r)
+xrotation_from_rotation (GnomeRRRotation r)
 {
     int i;
     Rotation result = 0;
-
+    
     for (i = 0; i < G_N_ELEMENTS (rotation_map); ++i)
     {
 	if (r & rotation_map[i].rot)
 	    result |= rotation_map[i].xrot;
     }
-
+    
     return result;
 }
 
 gboolean
-rw_crtc_set_config (RWCrtc    *crtc,
-		    int        x,
-		    int        y,
-		    RWMode    *mode,
-		    RWRotation rotation,
-		    RWOutput **outputs,
-		    int        n_outputs)
+gnome_rr_crtc_set_config (GnomeRRCrtc      *crtc,
+			  int               x,
+			  int               y,
+			  GnomeRRMode      *mode,
+			  GnomeRRRotation   rotation,
+			  GnomeRROutput   **outputs,
+			  int               n_outputs)
 {
     ScreenInfo *info;
     GArray *output_ids;
     int i;
-
+    
     g_return_val_if_fail (crtc != NULL, FALSE);
     g_return_val_if_fail (mode != NULL || outputs == NULL || n_outputs == 0, FALSE);
-
+    
     info = crtc->info;
     
     if (mode)
@@ -931,9 +924,9 @@
 	g_return_val_if_fail (x + mode->width <= info->max_width, FALSE);
 	g_return_val_if_fail (y + mode->height <= info->max_height, FALSE);
     }
-
+    
     output_ids = g_array_new (FALSE, FALSE, sizeof (RROutput));
-
+    
     if (outputs)
     {
 	for (i = 0; i < n_outputs; ++i)
@@ -947,34 +940,34 @@
 		      xrotation_from_rotation (rotation),
 		      (RROutput *)output_ids->data,
 		      output_ids->len);
-
+    
     g_array_free (output_ids, TRUE);
     
     return TRUE;
 }
 
-RWMode *
-rw_crtc_get_current_mode (RWCrtc *crtc)
+GnomeRRMode *
+gnome_rr_crtc_get_current_mode (GnomeRRCrtc *crtc)
 {
     g_return_val_if_fail (crtc != NULL, NULL);
-
+    
     return crtc->current_mode;
 }
 
 guint32
-rw_crtc_get_id (RWCrtc *crtc)
+gnome_rr_crtc_get_id (GnomeRRCrtc *crtc)
 {
     g_return_val_if_fail (crtc != NULL, 0);
-
+    
     return crtc->id;
 }
 
 gboolean
-rw_crtc_can_drive_output (RWCrtc   *crtc,
-			  RWOutput *output)
+gnome_rr_crtc_can_drive_output (GnomeRRCrtc   *crtc,
+				GnomeRROutput *output)
 {
     int i;
-
+    
     g_return_val_if_fail (crtc != NULL, FALSE);
     g_return_val_if_fail (output != NULL, FALSE);
     
@@ -983,53 +976,53 @@
 	if (crtc->possible_outputs[i] == output)
 	    return TRUE;
     }
-
+    
     return FALSE;
 }
 
 /* FIXME: merge with get_mode()? */
 void
-rw_crtc_get_position (RWCrtc          *crtc,
-		      int             *x,
-		      int             *y)
+gnome_rr_crtc_get_position (GnomeRRCrtc *crtc,
+			    int         *x,
+			    int         *y)
 {
     g_return_if_fail (crtc != NULL);
     
     if (x)
 	*x = crtc->x;
-
+    
     if (y)
 	*y = crtc->y;
 }
 
 /* FIXME: merge with get_mode()? */
-RWRotation
-rw_crtc_get_current_rotation (RWCrtc *crtc)
+GnomeRRRotation
+gnome_rr_crtc_get_current_rotation (GnomeRRCrtc *crtc)
 {
     g_assert(crtc != NULL);
     return crtc->current_rotation;
 }
 
-RWRotation
-rw_crtc_get_rotations (RWCrtc *crtc)
+GnomeRRRotation
+gnome_rr_crtc_get_rotations (GnomeRRCrtc *crtc)
 {
     g_assert(crtc != NULL);
     return crtc->rotations;
 }
 
 gboolean
-rw_crtc_supports_rotation (RWCrtc *   crtc,
-			   RWRotation rotation)
+gnome_rr_crtc_supports_rotation (GnomeRRCrtc *   crtc,
+				 GnomeRRRotation rotation)
 {
     g_return_val_if_fail (crtc != NULL, FALSE);
     return (crtc->rotations & rotation);
 }
 
-static RWCrtc *
+static GnomeRRCrtc *
 crtc_new (ScreenInfo *info, RROutput id)
 {
-    RWCrtc *crtc = g_new0 (RWCrtc, 1);
-
+    GnomeRRCrtc *crtc = g_new0 (GnomeRRCrtc, 1);
+    
     crtc->id = id;
     crtc->info = info;
     
@@ -1037,21 +1030,22 @@
 }
 
 static void
-crtc_initialize (RWCrtc *crtc, XRRScreenResources *res)
+crtc_initialize (GnomeRRCrtc        *crtc,
+		 XRRScreenResources *res)
 {
     XRRCrtcInfo *info = XRRGetCrtcInfo (DISPLAY (crtc), res, crtc->id);
     GPtrArray *a;
     int i;
     
     g_print ("CRTC %lx Timestamp: %u\n", crtc->id, (guint32)info->timestamp);
-	
+    
     if (!info)
     {
 	/* FIXME: We need to reaquire the screen resources */
 	return;
     }
     
-    /* RWMode */
+    /* GnomeRRMode */
     crtc->current_mode = mode_by_id (crtc->info, info->mode);
     
     crtc->x = info->x;
@@ -1061,46 +1055,46 @@
     a = g_ptr_array_new ();
     for (i = 0; i < info->noutput; ++i)
     {
-	RWOutput *output = rw_output_by_id (crtc->info, info->outputs[i]);
+	GnomeRROutput *output = gnome_rr_output_by_id (crtc->info, info->outputs[i]);
 	
 	if (output)
 	    g_ptr_array_add (a, output);
     }
     g_ptr_array_add (a, NULL);
-    crtc->current_outputs = (RWOutput **)g_ptr_array_free (a, FALSE);
+    crtc->current_outputs = (GnomeRROutput **)g_ptr_array_free (a, FALSE);
     
     /* Possible outputs */
     a = g_ptr_array_new ();
     for (i = 0; i < info->npossible; ++i)
     {
-	RWOutput *output = rw_output_by_id (crtc->info, info->possible[i]);
+	GnomeRROutput *output = gnome_rr_output_by_id (crtc->info, info->possible[i]);
 	
 	if (output)
 	    g_ptr_array_add (a, output);
     }
     g_ptr_array_add (a, NULL);
-    crtc->possible_outputs = (RWOutput **)g_ptr_array_free (a, FALSE);
-
+    crtc->possible_outputs = (GnomeRROutput **)g_ptr_array_free (a, FALSE);
+    
     /* Rotations */
-    crtc->current_rotation = rw_rotation_from_xrotation (info->rotation);
-    crtc->rotations = rw_rotation_from_xrotation (info->rotations);
-
+    crtc->current_rotation = gnome_rr_rotation_from_xrotation (info->rotation);
+    crtc->rotations = gnome_rr_rotation_from_xrotation (info->rotations);
+    
     XRRFreeCrtcInfo (info);
 }
 
 static void
-crtc_free (RWCrtc *crtc)
+crtc_free (GnomeRRCrtc *crtc)
 {
     g_free (crtc->current_outputs);
     g_free (crtc->possible_outputs);
     g_free (crtc);
 }
 
-/* RWMode */
-static RWMode *
+/* GnomeRRMode */
+static GnomeRRMode *
 mode_new (ScreenInfo *info, RRMode id)
 {
-    RWMode *mode = g_new0 (RWMode, 1);
+    GnomeRRMode *mode = g_new0 (GnomeRRMode, 1);
     
     mode->id = id;
     mode->info = info;
@@ -1109,39 +1103,39 @@
 }
 
 guint32
-rw_mode_get_id (RWMode *mode)
+gnome_rr_mode_get_id (GnomeRRMode *mode)
 {
     g_return_val_if_fail (mode != NULL, 0);
     return mode->id;
 }
 
 guint
-rw_mode_get_width (RWMode *mode)
+gnome_rr_mode_get_width (GnomeRRMode *mode)
 {
     g_return_val_if_fail (mode != NULL, 0);
     return mode->width;
 }
 
 int
-rw_mode_get_freq (RWMode *mode)
+gnome_rr_mode_get_freq (GnomeRRMode *mode)
 {
     g_return_val_if_fail (mode != NULL, 0);
     return (mode->freq) / 1000;
 }
 
 guint
-rw_mode_get_height (RWMode *mode)
+gnome_rr_mode_get_height (GnomeRRMode *mode)
 {
     g_return_val_if_fail (mode != NULL, 0);
     return mode->height;
 }
 
 static void
-mode_initialize (RWMode *mode, XRRModeInfo *info)
+mode_initialize (GnomeRRMode *mode, XRRModeInfo *info)
 {
     g_assert (mode != NULL);
     g_assert (info != NULL);
-
+    
     mode->name = g_strdup (info->name);
     mode->width = info->width;
     mode->height = info->height;
@@ -1149,7 +1143,7 @@
 }
 
 static void
-mode_free (RWMode *mode)
+mode_free (GnomeRRMode *mode)
 {
     g_free (mode->name);
     g_free (mode);
@@ -1158,7 +1152,7 @@
 
 #ifdef INCLUDE_MAIN
 static void
-on_screen_changed (RWScreen *screen, gpointer data)
+on_screen_changed (GnomeRRScreen *screen, gpointer data)
 {
     g_print ("Changed\n");
 }
@@ -1166,10 +1160,10 @@
 static gboolean
 do_refresh (gpointer data)
 {
-    RWScreen *screen = data;
-
-    rw_screen_refresh (screen);
-
+    GnomeRRScreen *screen = data;
+    
+    gnome_rr_screen_refresh (screen);
+    
     return TRUE;
 }
 
@@ -1180,13 +1174,13 @@
     
     gtk_init (&argc, &argv);
     
-    RWScreen *screen = rw_screen_new (gdk_screen_get_default(),
-				   on_screen_changed,
-				   NULL);
+    GnomeRRScreen *screen = gnome_rr_screen_new (gdk_screen_get_default(),
+					    on_screen_changed,
+					    NULL);
     
     for (i = 0; screen->info->crtcs[i]; ++i)
     {
-	RWCrtc *crtc = screen->info->crtcs[i];
+	GnomeRRCrtc *crtc = screen->info->crtcs[i];
 	
 	if (crtc->current_mode)
 	{
@@ -1202,7 +1196,7 @@
     
     for (i = 0; screen->info->outputs[i]; ++i)
     {
-	RWOutput *output = screen->info->outputs[i];
+	GnomeRROutput *output = screen->info->outputs[i];
 	
 	g_print ("Output %s currently", output->name);
 	
@@ -1211,7 +1205,7 @@
 	else
 	    g_print (" driven by CRTC %p\n", output->current_crtc);
     }
-
+    
     g_timeout_add (500, do_refresh, screen);
     
     gtk_main ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]