diff --git a/gnome-desktop-randr-1.2.diff b/gnome-desktop-randr-1.2.diff index 411663f..226c709 100644 --- a/gnome-desktop-randr-1.2.diff +++ b/gnome-desktop-randr-1.2.diff @@ -1,37 +1,3 @@ -diff --git a/configure.in b/configure.in -index f18ad7b..5b0202b 100644 ---- a/configure.in -+++ b/configure.in -@@ -51,10 +51,10 @@ AC_SUBST(GNOME_MICRO) - AC_SUBST(GNOME_DISTRIBUTOR) - AC_SUBST(GNOME_DATE) - --GNOME_COMMON_INIT --GNOME_DEBUG_CHECK --GNOME_COMPILE_WARNINGS([maximum]) --GNOME_MAINTAINER_MODE_DEFINES -+#GNOME_COMMON_INIT -+#GNOME_DEBUG_CHECK -+#GNOME_COMPILE_WARNINGS([maximum]) -+#GNOME_MAINTAINER_MODE_DEFINES - - # As a special favour for vuntz, support --disable-deprecations - -diff --git a/libgnome-desktop/ChangeLog b/libgnome-desktop/ChangeLog -index a6a4486..bc95a61 100644 ---- a/libgnome-desktop/ChangeLog -+++ b/libgnome-desktop/ChangeLog -@@ -1,3 +1,10 @@ -+2008-04-17 James Westby -+ -+ * monitor-db.c (configuration_new_current): Invert the logic in -+ the detection of clone mode so that it works for a single screen -+ as well. Without this change single screens are always reported as -+ clone, which makes no sense. -+ - 2008-03-29 Matthias Clasen - - * gnome-bg.c (get_current_slide): Handle start times in diff --git a/libgnome-desktop/Makefile.am b/libgnome-desktop/Makefile.am index 08e1395..68bf653 100644 --- a/libgnome-desktop/Makefile.am @@ -867,10 +833,37 @@ index 0000000..2611a24 +} diff --git a/libgnome-desktop/edid.h b/libgnome-desktop/edid.h new file mode 100644 -index 0000000..4f0573a +index 0000000..3a6cbf2 --- /dev/null +++ b/libgnome-desktop/edid.h -@@ -0,0 +1,170 @@ +@@ -0,0 +1,199 @@ ++/* edid.h ++ * ++ * Copyright 2007, 2008, Red Hat, Inc. ++ * ++ * This file is part of the Gnome Library. ++ * ++ * The Gnome Library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public License as ++ * published by the Free Software Foundation; either version 2 of the ++ * License, or (at your option) any later version. ++ * ++ * The Gnome Library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with the Gnome Library; see the file COPYING.LIB. If not, ++ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ * Boston, MA 02111-1307, USA. ++ * ++ * Author: Soren Sandmann ++ */ ++ ++#ifndef EDID_H ++#define EDID_H ++ +typedef unsigned char uchar; +typedef struct MonitorInfo MonitorInfo; +typedef struct Timing Timing; @@ -1041,6 +1034,8 @@ index 0000000..4f0573a +MonitorInfo *decode_edid (const uchar *data); +char * make_display_name (const char *output_name, + const MonitorInfo *info); ++ ++#endif diff --git a/libgnome-desktop/libgnomeui/Makefile.am b/libgnome-desktop/libgnomeui/Makefile.am index 24c762b..0a143b3 100644 --- a/libgnome-desktop/libgnomeui/Makefile.am @@ -1059,13 +1054,40 @@ index 24c762b..0a143b3 100644 + monitor-db.h diff --git a/libgnome-desktop/libgnomeui/monitor-db.h b/libgnome-desktop/libgnomeui/monitor-db.h new file mode 100644 -index 0000000..05c7749 +index 0000000..07555b6 --- /dev/null +++ b/libgnome-desktop/libgnomeui/monitor-db.h -@@ -0,0 +1,52 @@ +@@ -0,0 +1,79 @@ ++/* monitor-db.h ++ * ++ * Copyright 2007, 2008, Red Hat, Inc. ++ * ++ * This file is part of the Gnome Library. ++ * ++ * The Gnome Library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public License as ++ * published by the Free Software Foundation; either version 2 of the ++ * License, or (at your option) any later version. ++ * ++ * The Gnome Library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with the Gnome Library; see the file COPYING.LIB. If not, ++ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ * Boston, MA 02111-1307, USA. ++ * ++ * Author: Soren Sandmann ++ */ +#ifndef MONITOR_DB_H +#define MONITOR_DB_H + ++#ifndef GNOME_DESKTOP_USE_UNSTABLE_API ++#error monitor-db.h is unstable API. You must define GNOME_DESKTOP_USE_UNSTABLE_API before including monitor-db.h ++#endif ++ +#include +#include + @@ -1117,13 +1139,40 @@ index 0000000..05c7749 +#endif diff --git a/libgnome-desktop/libgnomeui/randrwrap.h b/libgnome-desktop/libgnomeui/randrwrap.h new file mode 100644 -index 0000000..f9ab2c9 +index 0000000..b185051 --- /dev/null +++ b/libgnome-desktop/libgnomeui/randrwrap.h -@@ -0,0 +1,96 @@ +@@ -0,0 +1,123 @@ ++/* randrwrap.h ++ * ++ * Copyright 2007, 2008, Red Hat, Inc. ++ * ++ * This file is part of the Gnome Library. ++ * ++ * The Gnome Library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public License as ++ * published by the Free Software Foundation; either version 2 of the ++ * License, or (at your option) any later version. ++ * ++ * The Gnome Library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with the Gnome Library; see the file COPYING.LIB. If not, ++ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ * Boston, MA 02111-1307, USA. ++ * ++ * Author: Soren Sandmann ++ */ +#ifndef RANDR_WRAP_H +#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 ++#endif ++ +#include +#include + @@ -1219,16 +1268,69 @@ index 0000000..f9ab2c9 +#endif diff --git a/libgnome-desktop/monitor-db.c b/libgnome-desktop/monitor-db.c new file mode 100644 -index 0000000..a9b064d +index 0000000..ff6e8de --- /dev/null +++ b/libgnome-desktop/monitor-db.c -@@ -0,0 +1,1292 @@ +@@ -0,0 +1,1406 @@ ++/* monitor-db.c ++ * ++ * Copyright 2007, 2008, Red Hat, Inc. ++ * ++ * This file is part of the Gnome Library. ++ * ++ * The Gnome Library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public License as ++ * published by the Free Software Foundation; either version 2 of the ++ * License, or (at your option) any later version. ++ * ++ * The Gnome Library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with the Gnome Library; see the file COPYING.LIB. If not, ++ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ * Boston, MA 02111-1307, USA. ++ * ++ * Author: Soren Sandmann ++ */ ++ ++#define GNOME_DESKTOP_USE_UNSTABLE_API ++ +#include +#include +#include ++#include +#include "libgnomeui/monitor-db.h" +#include "edid.h" + ++#define CONFIG_BASENAME "monitors.xml" ++ ++/* In version 0 of the config file format, we had several toplevel elements ++ * and no explicit version number. So, the filed looked like ++ * ++ * ++ * ... ++ * ++ * ++ * ... ++ * ++ * ++ * Since version 1 of the config file, the file has a toplevel element to group ++ * all the configurations. That element has a "version" attribute which is an integer. ++ * So, the file looks like this: ++ * ++ * ++ * ++ * ... ++ * ++ * ++ * ... ++ * ++ * ++ */ ++ +/* A helper wrapper around the GMarkup parser stuff */ +static gboolean parse_file_gmarkup (const gchar *file, + const GMarkupParser *parser, @@ -1244,11 +1346,15 @@ index 0000000..a9b064d +static void output_free (Output *output); +static Output * output_copy (Output *output); + ++static gchar *get_old_config_filename (void); ++static gchar *get_config_filename (void); ++ +typedef struct Parser Parser; + +/* Parser for monitor configurations */ +struct Parser +{ ++ int config_file_version; + Output *output; + Configuration *configuration; + GPtrArray *outputs; @@ -1356,6 +1462,19 @@ index 0000000..a9b064d + parser->configuration->clone = FALSE; + parser->configuration->outputs = g_new0 (Output *, 1); + } ++ else if (strcmp (name, "monitors") == 0) ++ { ++ int i; ++ ++ for (i = 0; attr_names[i] != NULL; i++) ++ { ++ if (strcmp (attr_names[i], "version") == 0) ++ { ++ parser->config_file_version = parse_int (attr_values[i]); ++ break; ++ } ++ } ++ } + + g_queue_push_tail (parser->stack, g_strdup (name)); +} @@ -1391,6 +1510,8 @@ index 0000000..a9b064d + g_free (g_queue_pop_tail (parser->stack)); +} + ++#define TOPLEVEL_ELEMENT (parser->config_file_version > 0 ? "monitors" : NULL) ++ +static void +handle_text (GMarkupParseContext *context, + const gchar *text, @@ -1400,61 +1521,61 @@ index 0000000..a9b064d +{ + Parser *parser = user_data; + -+ if (stack_is (parser, "vendor", "output", "configuration", NULL)) ++ if (stack_is (parser, "vendor", "output", "configuration", TOPLEVEL_ELEMENT, NULL)) + { + parser->output->connected = TRUE; + + strncpy (parser->output->vendor, text, 3); + parser->output->vendor[3] = 0; + } -+ else if (stack_is (parser, "clone", "configuration", NULL)) ++ else if (stack_is (parser, "clone", "configuration", TOPLEVEL_ELEMENT, NULL)) + { + if (strcmp (text, "yes") == 0) + parser->configuration->clone = TRUE; + } -+ else if (stack_is (parser, "product", "output", "configuration", NULL)) ++ else if (stack_is (parser, "product", "output", "configuration", TOPLEVEL_ELEMENT, NULL)) + { + parser->output->connected = TRUE; + + parser->output->product = parse_int (text); + } -+ else if (stack_is (parser, "serial", "output", "configuration", NULL)) ++ else if (stack_is (parser, "serial", "output", "configuration", TOPLEVEL_ELEMENT, NULL)) + { + parser->output->connected = TRUE; + + parser->output->serial = parse_uint (text); + } -+ else if (stack_is (parser, "width", "output", "configuration", NULL)) ++ else if (stack_is (parser, "width", "output", "configuration", TOPLEVEL_ELEMENT, NULL)) + { + parser->output->on = TRUE; + + parser->output->width = parse_int (text); + } -+ else if (stack_is (parser, "x", "output", "configuration", NULL)) ++ else if (stack_is (parser, "x", "output", "configuration", TOPLEVEL_ELEMENT, NULL)) + { + parser->output->on = TRUE; + + parser->output->x = parse_int (text); + } -+ else if (stack_is (parser, "y", "output", "configuration", NULL)) ++ else if (stack_is (parser, "y", "output", "configuration", TOPLEVEL_ELEMENT, NULL)) + { + parser->output->on = TRUE; + + parser->output->y = parse_int (text); + } -+ else if (stack_is (parser, "height", "output", "configuration", NULL)) ++ else if (stack_is (parser, "height", "output", "configuration", TOPLEVEL_ELEMENT, NULL)) + { + parser->output->on = TRUE; + + parser->output->height = parse_int (text); + } -+ else if (stack_is (parser, "rate", "output", "configuration", NULL)) ++ else if (stack_is (parser, "rate", "output", "configuration", TOPLEVEL_ELEMENT, NULL)) + { + parser->output->on = TRUE; + + parser->output->rate = parse_int (text); + } -+ else if (stack_is (parser, "rotation", "output", "configuration", NULL)) ++ else if (stack_is (parser, "rotation", "output", "configuration", TOPLEVEL_ELEMENT, NULL)) + { + if (strcmp (text, "normal") == 0) + { @@ -1473,14 +1594,14 @@ index 0000000..a9b064d + parser->output->rotation |= RW_ROTATION_270; + } + } -+ else if (stack_is (parser, "reflect_x", "output", "configuration", NULL)) ++ else if (stack_is (parser, "reflect_x", "output", "configuration", TOPLEVEL_ELEMENT, NULL)) + { + if (strcmp (text, "yes") == 0) + { + parser->output->rotation |= RW_REFLECT_X; + } + } -+ else if (stack_is (parser, "reflect_y", "output", "configuration", NULL)) ++ else if (stack_is (parser, "reflect_y", "output", "configuration", TOPLEVEL_ELEMENT, NULL)) + { + if (strcmp (text, "yes") == 0) + { @@ -1533,7 +1654,7 @@ index 0000000..a9b064d +} + +static Configuration ** -+configurations_read (const gchar *filename, GError **error) ++configurations_read_from_file (const gchar *filename, GError **error) +{ + Parser *parser = g_new0 (Parser, 1); + Configuration **result; @@ -1545,6 +1666,7 @@ index 0000000..a9b064d + NULL, /* error */ + }; + ++ parser->config_file_version = 0; + parser->configurations = g_ptr_array_new (); + parser->outputs = g_ptr_array_new (); + parser->stack = g_queue_new (); @@ -1570,6 +1692,38 @@ index 0000000..a9b064d + return result; +} + ++static Configuration ** ++configurations_read (GError **error) ++{ ++ char *filename; ++ Configuration **configs; ++ GError *err; ++ ++ /* Try the new configuration file... */ ++ ++ filename = get_config_filename (); ++ ++ err = NULL; ++ configs = configurations_read_from_file (filename, &err); ++ ++ g_free (filename); ++ ++ if (g_error_matches (err, G_FILE_ERROR, G_FILE_ERROR_NOENT)) ++ { ++ g_error_free (err); ++ ++ /* Okay, so try the old configuration file */ ++ filename = get_old_config_filename (); ++ configs = configurations_read_from_file (filename, error); ++ g_free (filename); ++ ++ return configs; ++ } ++ ++ g_propagate_error (error, err); ++ return configs; ++} ++ +Configuration * +configuration_new_current (RWScreen *screen) +{ @@ -1943,27 +2097,17 @@ index 0000000..a9b064d +} + +/* Database management */ -+static gboolean -+do_free (gpointer data) ++ ++static gchar * ++get_old_config_filename (void) +{ -+ g_free (data); -+ return FALSE; ++ return g_build_filename (g_get_home_dir(), ".gnome2", CONFIG_BASENAME, NULL); +} + +static gchar * -+idle_free (gchar *s) ++get_config_filename (void) +{ -+ g_idle_add (do_free, s); -+ -+ return s; -+} -+ -+static const gchar * -+get_filename (void) -+{ -+ return idle_free ( -+ g_build_filename ( -+ g_get_home_dir(), ".gnome2", "monitors.xml", NULL)); ++ return g_build_filename (g_get_user_config_dir (), CONFIG_BASENAME, NULL); +} + +static const char * @@ -2004,53 +2148,53 @@ index 0000000..a9b064d + GString *string) +{ + int j; -+ -+ g_string_append_printf (string, "\n"); + -+ g_string_append_printf (string, " %s\n", yes_no (config->clone)); ++ g_string_append_printf (string, " \n"); ++ ++ g_string_append_printf (string, " %s\n", yes_no (config->clone)); + + for (j = 0; config->outputs[j] != NULL; ++j) + { + Output *output = config->outputs[j]; + + g_string_append_printf ( -+ string, " \n", output->name); ++ string, " \n", output->name); + + if (output->connected && *output->vendor != '\0') + { + g_string_append_printf ( -+ string, " %s\n", output->vendor); ++ string, " %s\n", output->vendor); + g_string_append_printf ( -+ string, " 0x%04x\n", output->product); ++ string, " 0x%04x\n", output->product); + g_string_append_printf ( -+ string, " 0x%08x\n", output->serial); ++ string, " 0x%08x\n", output->serial); + } + + /* An unconnected output which is on does not make sense */ + if (output->connected && output->on) + { + g_string_append_printf ( -+ string, " %d\n", output->width); ++ string, " %d\n", output->width); + g_string_append_printf ( -+ string, " %d\n", output->height); ++ string, " %d\n", output->height); + g_string_append_printf ( -+ string, " %d\n", output->rate); ++ string, " %d\n", output->rate); + g_string_append_printf ( -+ string, " %d\n", output->x); ++ string, " %d\n", output->x); + g_string_append_printf ( -+ string, " %d\n", output->y); ++ string, " %d\n", output->y); + g_string_append_printf ( -+ string, " %s\n", get_rotation_name (output->rotation)); ++ string, " %s\n", get_rotation_name (output->rotation)); + g_string_append_printf ( -+ string, " %s\n", get_reflect_x (output->rotation)); ++ string, " %s\n", get_reflect_x (output->rotation)); + g_string_append_printf ( -+ string, " %s\n", get_reflect_y (output->rotation)); ++ string, " %s\n", get_reflect_y (output->rotation)); + } + -+ g_string_append_printf (string, " \n"); ++ g_string_append_printf (string, " \n"); + } + -+ g_string_append_printf (string, "\n"); ++ g_string_append_printf (string, " \n"); +} + +void @@ -2086,15 +2230,20 @@ index 0000000..a9b064d + } +} + ++ +gboolean +configuration_save (Configuration *configuration, GError **err) +{ + Configuration **configurations; + GString *output = g_string_new(""); + int i; ++ gchar *filename; ++ gboolean result; + -+ configurations = configurations_read (get_filename(), NULL); ++ configurations = configurations_read (NULL); /* NULL-GError */ + ++ g_string_append_printf (output, "\n"); ++ + if (configurations) + { + for (i = 0; configurations[i] != NULL; ++i) @@ -2108,7 +2257,24 @@ index 0000000..a9b064d + + emit_configuration (configuration, output); + -+ return g_file_set_contents (get_filename(), output->str, -1, err); ++ g_string_append_printf (output, "\n"); ++ ++ filename = get_config_filename (); ++ result = g_file_set_contents (filename, output->str, -1, err); ++ g_free (filename); ++ ++ if (result) ++ { ++ /* Only remove the old config file if we were successful in saving the new one */ ++ ++ filename = get_old_config_filename (); ++ if (g_file_test (filename, G_FILE_TEST_EXISTS)) ++ g_unlink (filename); ++ ++ g_free (filename); ++ } ++ ++ return result; +} + +static gboolean @@ -2138,9 +2304,7 @@ index 0000000..a9b064d +gboolean +configuration_apply_stored (RWScreen *screen) +{ -+ char *file = g_build_filename ( -+ g_get_home_dir(), ".gnome2", "monitors.xml", NULL); -+ Configuration **configs = configurations_read (file, NULL); ++ Configuration **configs = configurations_read (NULL); /* NULL-GError */ + Configuration *current; + Configuration *found; + gboolean result; @@ -2166,7 +2330,6 @@ index 0000000..a9b064d + configurations_free (configs); + } + -+ g_free (file); + configuration_free (current); + + return result; @@ -2517,10 +2680,36 @@ index 0000000..a9b064d +} diff --git a/libgnome-desktop/randrwrap.c b/libgnome-desktop/randrwrap.c new file mode 100644 -index 0000000..6b4cecb +index 0000000..bffeada --- /dev/null +++ b/libgnome-desktop/randrwrap.c -@@ -0,0 +1,1195 @@ +@@ -0,0 +1,1221 @@ ++/* randrwrap.c ++ * ++ * Copyright 2007, 2008, Red Hat, Inc. ++ * ++ * This file is part of the Gnome Library. ++ * ++ * The Gnome Library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public License as ++ * published by the Free Software Foundation; either version 2 of the ++ * License, or (at your option) any later version. ++ * ++ * The Gnome Library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with the Gnome Library; see the file COPYING.LIB. If not, ++ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ * Boston, MA 02111-1307, USA. ++ * ++ * Author: Soren Sandmann ++ */ ++ ++#define GNOME_DESKTOP_USE_UNSTABLE_API ++ +#include "libgnomeui/randrwrap.h" +#include +#include diff --git a/gnome-desktop.changes b/gnome-desktop.changes index 64eadda..7a0b995 100644 --- a/gnome-desktop.changes +++ b/gnome-desktop.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu May 29 20:38:11 CEST 2008 - federico@novell.com + +- Updated gnome-desktop-randr-1.2.diff with the latest fixes from upstream. + ------------------------------------------------------------------- Sun May 11 11:50:55 CEST 2008 - coolo@suse.de diff --git a/gnome-desktop.spec b/gnome-desktop.spec index 7c68b3c..395fa1e 100644 --- a/gnome-desktop.spec +++ b/gnome-desktop.spec @@ -17,7 +17,7 @@ License: GNU Free Documentation License, Version 1.1 (GFDL 1.1); GPL v2 o Group: System/GUI/GNOME Obsoletes: gnome-core Version: 2.22.1 -Release: 20 +Release: 23 Summary: The GNOME Desktop API Library Source: %{name}-%{version}.tar.bz2 Url: http://www.gnome.org @@ -182,6 +182,8 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/gtk-doc/html/gnome-desktop %changelog +* Thu May 29 2008 federico@novell.com +- Updated gnome-desktop-randr-1.2.diff with the latest fixes from upstream. * Sun May 11 2008 coolo@suse.de - fix renames of xxbit packages * Thu May 08 2008 federico@novell.com