rpms/gnome-desktop/devel clone-modes.patch, NONE, 1.1 gnome-desktop.spec, 1.158, 1.159
Soren Sandmann Pedersen
ssp at fedoraproject.org
Thu Sep 4 03:29:44 UTC 2008
- Previous message (by thread): rpms/kernel/devel patch-2.6.27-rc5-git5.bz2.sign, NONE, 1.1 .cvsignore, 1.913, 1.914 kernel.spec, 1.924, 1.925 linux-2.6-iwlwifi-use-dma_alloc_coherent.patch, 1.1, 1.2 sources, 1.876, 1.877 upstream, 1.789, 1.790 patch-2.6.27-rc5-git3.bz2.sign, 1.1, NONE
- Next message (by thread): rpms/gnome-desktop/devel gnome-desktop.spec,1.159,1.160
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: ssp
Update of /cvs/pkgs/rpms/gnome-desktop/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9244
Modified Files:
gnome-desktop.spec
Added Files:
clone-modes.patch
Log Message:
Patch to move clone mode enumeration to gnome-rr.c
clone-modes.patch:
--- NEW FILE clone-modes.patch ---
Index: libgnome-desktop/libgnomeui/gnome-rr-config.h
===================================================================
--- libgnome-desktop/libgnomeui/gnome-rr-config.h (revision 5210)
+++ libgnome-desktop/libgnomeui/gnome-rr-config.h (working copy)
@@ -34,6 +34,13 @@
typedef struct GnomeOutputInfo GnomeOutputInfo;
typedef struct GnomeRRConfig GnomeRRConfig;
+/* FIXME:
+ *
+ * This structure is a Frankenstein monster where all of the fields
+ * are generated by the system, but some of them can be changed by
+ * the client.
+ */
+
struct GnomeOutputInfo
{
char * name;
@@ -66,14 +73,24 @@
};
GnomeRRConfig *gnome_rr_config_new_current (GnomeRRScreen *screen);
+GnomeRRConfig *gnome_rr_config_new_stored (GnomeRRScreen *screen);
void gnome_rr_config_free (GnomeRRConfig *configuration);
gboolean gnome_rr_config_match (GnomeRRConfig *config1,
GnomeRRConfig *config2);
+gboolean gnome_rr_config_equal (GnomeRRConfig *config1,
+ GnomeRRConfig *config2);
gboolean gnome_rr_config_save (GnomeRRConfig *configuration,
GError **err);
void gnome_rr_config_sanitize (GnomeRRConfig *configuration);
+gboolean gnome_rr_config_apply (GnomeRRConfig *configuration,
+ GnomeRRScreen *screen);
gboolean gnome_rr_config_apply_stored (GnomeRRScreen *screen);
gboolean gnome_rr_config_applicable (GnomeRRConfig *configuration,
GnomeRRScreen *screen);
+/* A utility function that isn't really in the spirit of this file, but I don't
+ * don't know a better place for it.
+ */
+GnomeRRMode **gnome_rr_create_clone_modes (GnomeRRScreen *screen);
+
#endif
Index: libgnome-desktop/libgnomeui/gnome-rr.h
===================================================================
--- libgnome-desktop/libgnomeui/gnome-rr.h (revision 5210)
+++ libgnome-desktop/libgnomeui/gnome-rr.h (working copy)
@@ -56,6 +56,7 @@
GnomeRROutput **gnome_rr_screen_list_outputs (GnomeRRScreen *screen);
GnomeRRCrtc ** gnome_rr_screen_list_crtcs (GnomeRRScreen *screen);
GnomeRRMode ** gnome_rr_screen_list_modes (GnomeRRScreen *screen);
+GnomeRRMode ** gnome_rr_screen_list_clone_modes (GnomeRRScreen *screen);
void gnome_rr_screen_set_size (GnomeRRScreen *screen,
int width,
int height,
Index: libgnome-desktop/gnome-rr.c
===================================================================
--- libgnome-desktop/gnome-rr.c (revision 5210)
+++ libgnome-desktop/gnome-rr.c (working copy)
@@ -50,6 +50,8 @@
GnomeRRMode ** modes;
GnomeRRScreen * screen;
+
+ GnomeRRMode ** clone_modes;
};
struct GnomeRRScreen
@@ -222,11 +224,86 @@
mode_free (*mode);
g_free (info->modes);
}
+
+ if (info->clone_modes)
+ {
+ /* The modes themselves were freed above */
+ g_free (info->clone_modes);
+ }
g_free (info);
}
static gboolean
+has_similar_mode (GnomeRROutput *output, GnomeRRMode *mode)
+{
+ int i;
+ GnomeRRMode **modes = gnome_rr_output_list_modes (output);
+ int width = gnome_rr_mode_get_width (mode);
+ int height = gnome_rr_mode_get_height (mode);
+
+ for (i = 0; modes[i] != NULL; ++i)
+ {
+ GnomeRRMode *m = modes[i];
+
+ if (gnome_rr_mode_get_width (m) == width &&
+ gnome_rr_mode_get_height (m) == height)
+ {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+static void
+gather_clone_modes (ScreenInfo *info)
+{
+ int i;
+ GPtrArray *result = g_ptr_array_new ();
+
+ for (i = 0; info->outputs[i] != NULL; ++i)
+ {
+ int j;
+ GnomeRROutput *output1, *output2;
+
+ output1 = info->outputs[i];
+
+ if (!output1->connected)
+ continue;
+
+ for (j = 0; output1->modes[j] != NULL; ++j)
+ {
+ GnomeRRMode *mode = output1->modes[j];
+ gboolean valid;
+ int k;
+
+ valid = TRUE;
+ for (k = 0; info->outputs[k] != NULL; ++k)
+ {
+ output2 = info->outputs[k];
+
+ if (!output2->connected)
+ continue;
+
+ if (!has_similar_mode (output2, mode))
+ {
+ valid = FALSE;
+ break;
+ }
+ }
+
+ if (valid)
+ g_ptr_array_add (result, mode);
+ }
+ }
+
+ g_ptr_array_add (result, NULL);
+
+ info->clone_modes = (GnomeRRMode **)g_ptr_array_free (result, FALSE);
+}
+
+static gboolean
fill_out_screen_info (Display *xdisplay,
Window xroot,
ScreenInfo *info)
@@ -322,6 +399,8 @@
mode_initialize (mode, &(resources->modes[i]));
}
+
+ gather_clone_modes (info);
return TRUE;
}
@@ -526,6 +605,15 @@
return screen->info->modes;
}
+GnomeRRMode **
+gnome_rr_screen_list_clone_modes (GnomeRRScreen *screen)
+{
+ g_return_val_if_fail (screen != NULL, NULL);
+ g_return_val_if_fail (screen->info != NULL, NULL);
+
+ return screen->info->clone_modes;
+}
+
GnomeRRCrtc **
gnome_rr_screen_list_crtcs (GnomeRRScreen *screen)
{
Index: libgnome-desktop/gnome-rr-config.c
===================================================================
--- libgnome-desktop/gnome-rr-config.c (revision 5210)
+++ libgnome-desktop/gnome-rr-config.c (working copy)
@@ -745,6 +745,42 @@
return TRUE;
}
+static gboolean
+output_equal (GnomeOutputInfo *output1, GnomeOutputInfo *output2)
+{
+ g_assert (output1 != NULL);
+ g_assert (output2 != NULL);
+
+ if (!output_match (output1, output2))
+ return FALSE;
+
+ if (output1->on != output2->on)
+ return FALSE;
+
+ if (output1->on)
+ {
+ if (output1->width != output2->width)
+ return FALSE;
+
+ if (output1->height != output2->height)
+ return FALSE;
+
+ if (output1->rate != output2->rate)
+ return FALSE;
+
+ if (output1->x != output2->x)
+ return FALSE;
+
+ if (output1->y != output2->y)
+ return FALSE;
+
+ if (output1->rotation != output2->rotation)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static GnomeOutputInfo *
find_output (GnomeRRConfig *config, const char *name)
{
@@ -761,6 +797,9 @@
return NULL;
}
+/* Match means "these configurations apply to the same hardware
+ * setups"
+ */
gboolean
gnome_rr_config_match (GnomeRRConfig *c1, GnomeRRConfig *c2)
{
@@ -779,6 +818,28 @@
return TRUE;
}
+/* Equal means "the configurations will result in the same
+ * modes being set on the outputs"
+ */
+gboolean
+gnome_rr_config_equal (GnomeRRConfig *c1,
+ GnomeRRConfig *c2)
+{
+ int i;
+
+ for (i = 0; c1->outputs[i] != NULL; ++i)
+ {
+ GnomeOutputInfo *output1 = c1->outputs[i];
+ GnomeOutputInfo *output2;
+
+ output2 = find_output (c2, output1->name);
+ if (!output2 || !output_equal (output1, output2))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static GnomeOutputInfo **
make_outputs (GnomeRRConfig *config)
{
@@ -840,21 +901,6 @@
return result;
}
-static GnomeRRConfig *
-gnome_rr_config_find (GnomeRRConfig **haystack,
- GnomeRRConfig *needle)
-{
- int i;
-
- for (i = 0; haystack[i] != NULL; ++i)
- {
- if (gnome_rr_config_match (haystack[i], needle))
- return haystack[i];
- }
-
- return NULL;
-}
-
/* Database management */
static gchar *
@@ -1036,13 +1082,67 @@
return result;
}
-static gboolean
-apply_configuration (GnomeRRConfig *conf, GnomeRRScreen *screen)
+static GnomeRRConfig *
+gnome_rr_config_copy (GnomeRRConfig *config)
{
+ GnomeRRConfig *copy = g_new0 (GnomeRRConfig, 1);
+ int i;
+ GPtrArray *array = g_ptr_array_new ();
+
+ copy->clone = config->clone;
+
+ for (i = 0; config->outputs[i] != NULL; ++i)
+ g_ptr_array_add (array, output_copy (config->outputs[i]));
+
+ g_ptr_array_add (array, NULL);
+ copy->outputs = (GnomeOutputInfo **)g_ptr_array_free (array, FALSE);
+
+ return copy;
+}
+
+GnomeRRConfig *
+gnome_rr_config_new_stored (GnomeRRScreen *screen)
+{
+ GnomeRRConfig *current;
+ GnomeRRConfig **configs;
+ GnomeRRConfig *result;
+
+ if (!screen)
+ return NULL;
+
+ current = gnome_rr_config_new_current (screen);
+
+ configs = configurations_read (NULL); /* NULL_GError */
+
+ result = NULL;
+ if (configs)
+ {
+ int i;
+
+ for (i = 0; configs[i] != NULL; ++i)
+ {
+ if (gnome_rr_config_match (configs[i], current))
+ {
+ result = gnome_rr_config_copy (configs[i]);
+ break;
+ }
+ }
+ }
+
+ gnome_rr_config_free (current);
+ configurations_free (configs);
+
+ return result;
+}
+
+gboolean
+gnome_rr_config_apply (GnomeRRConfig *config,
+ GnomeRRScreen *screen)
+{
CrtcAssignment *assignment;
GnomeOutputInfo **outputs;
- outputs = make_outputs (conf);
+ outputs = make_outputs (config);
assignment = crtc_assignment_new (screen, outputs);
@@ -1065,42 +1165,51 @@
gboolean
gnome_rr_config_apply_stored (GnomeRRScreen *screen)
{
- GnomeRRConfig **configs;
- GnomeRRConfig *current;
- GnomeRRConfig *found;
- gboolean result = TRUE;
+ GnomeRRConfig *stored;
if (!screen)
return FALSE;
- configs = configurations_read (NULL); /* NULL-GError */
-
gnome_rr_screen_refresh (screen);
-
- current = gnome_rr_config_new_current (screen);
- if (configs)
+ stored = gnome_rr_config_new_stored (screen);
+
+ if (stored)
{
- if ((found = gnome_rr_config_find (configs, current)))
- {
- apply_configuration (found, screen);
+ gnome_rr_config_apply (stored, screen);
- result = TRUE;
- }
- else
+ gnome_rr_config_free (stored);
+
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+}
+
+static gboolean
+has_similar_mode (GnomeRROutput *output, GnomeRRMode *mode)
+{
+ int i;
+ GnomeRRMode **modes = gnome_rr_output_list_modes (output);
+ int width = gnome_rr_mode_get_width (mode);
+ int height = gnome_rr_mode_get_height (mode);
+
+ for (i = 0; modes[i] != NULL; ++i)
+ {
+ GnomeRRMode *m = modes[i];
+
+ if (gnome_rr_mode_get_width (m) == width &&
+ gnome_rr_mode_get_height (m) == height)
{
- result = FALSE;
+ return TRUE;
}
-
- configurations_free (configs);
}
-
- gnome_rr_config_free (current);
- return result;
+ return FALSE;
}
-
/*
* CRTC assignment
*/
Index: gnome-desktop.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gnome-desktop/devel/gnome-desktop.spec,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -r1.158 -r1.159
--- gnome-desktop.spec 3 Sep 2008 02:18:49 -0000 1.158
+++ gnome-desktop.spec 4 Sep 2008 03:29:14 -0000 1.159
@@ -21,6 +21,7 @@
# http://bugzilla.gnome.org/show_bug.cgi?id=549960
Patch2: rr-leaks.patch
+Patch3: clone-modes.patch
Requires: redhat-menus
Requires: pycairo
@@ -74,6 +75,7 @@
%prep
%setup -q
%patch2 -p1 -b .rr-leaks
+%patch3 -p0 -b .clone-modes
%build
%configure --with-gnome-distributor="Red Hat, Inc" --disable-scrollkeeper
@@ -119,6 +121,9 @@
%doc %{_datadir}/gtk-doc/html/gnome-desktop/
%changelog
+* Wed Sep 3 2008 Soren Sandmann <sandmann at redhat.com> - 2.23.91-2
+- Add patch to move clone mode enumeration to gnome-rr.c
+
* Tue Sep 2 2008 Matthias Clasen <mclasen at redhat.com> - 2.23.91-1
- Update to 2.23.91
- Previous message (by thread): rpms/kernel/devel patch-2.6.27-rc5-git5.bz2.sign, NONE, 1.1 .cvsignore, 1.913, 1.914 kernel.spec, 1.924, 1.925 linux-2.6-iwlwifi-use-dma_alloc_coherent.patch, 1.1, 1.2 sources, 1.876, 1.877 upstream, 1.789, 1.790 patch-2.6.27-rc5-git3.bz2.sign, 1.1, NONE
- Next message (by thread): rpms/gnome-desktop/devel gnome-desktop.spec,1.159,1.160
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list