From ee155c415f5462341af6799d7495ba583ade2234a8dfd05c209a0d8d6e234865 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Fri, 15 Aug 2008 21:26:47 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gnome-desktop?expand=0&rev=35 --- gnome-desktop-randr-monitor-labeling.diff | 861 ++++++++++++++++++++++ gnome-desktop.changes | 7 + gnome-desktop.spec | 9 +- 3 files changed, 876 insertions(+), 1 deletion(-) create mode 100644 gnome-desktop-randr-monitor-labeling.diff diff --git a/gnome-desktop-randr-monitor-labeling.diff b/gnome-desktop-randr-monitor-labeling.diff new file mode 100644 index 0000000..65d6147 --- /dev/null +++ b/gnome-desktop-randr-monitor-labeling.diff @@ -0,0 +1,861 @@ +diff --git a/libgnome-desktop/Makefile.am b/libgnome-desktop/Makefile.am +index f8516ca..772a918 100644 +--- a/libgnome-desktop/Makefile.am ++++ b/libgnome-desktop/Makefile.am +@@ -24,6 +24,7 @@ libgnome_desktop_2_la_SOURCES = \ + display-name.c \ + gnome-rr.c \ + gnome-rr-config.c \ ++ gnome-rr-labeler.c \ + edid-parse.c \ + edid.h + +diff --git a/libgnome-desktop/gnome-rr-config.c b/libgnome-desktop/gnome-rr-config.c +index fece456..4c21fa1 100644 +--- a/libgnome-desktop/gnome-rr-config.c ++++ b/libgnome-desktop/gnome-rr-config.c +@@ -463,6 +463,7 @@ gnome_rr_config_new_current (GnomeRRScreen *screen) + int i; + int clone_width = -1; + int clone_height = -1; ++ int last_x; + + g_return_val_if_fail (screen != NULL, NULL); + +@@ -536,7 +537,7 @@ gnome_rr_config_new_current (GnomeRRScreen *screen) + clone_width = output->width; + clone_height = output->height; + } else if (clone_width == output->width && +- clone_height == output->height) { ++ clone_height == output->height) { + config->clone = TRUE; + } + } +@@ -588,6 +589,34 @@ gnome_rr_config_new_current (GnomeRRScreen *screen) + + config->outputs = (GnomeOutputInfo **)g_ptr_array_free (a, FALSE); + ++ /* Walk the outputs computing the right-most edge of all ++ * lit-up displays ++ */ ++ last_x = 0; ++ for (i = 0; config->outputs[i] != NULL; ++i) ++ { ++ GnomeOutputInfo *output = config->outputs[i]; ++ ++ if (output->on) ++ { ++ last_x = MAX (last_x, output->x + output->width); ++ } ++ } ++ ++ /* Now position all off displays to the right of the ++ * on displays ++ */ ++ for (i = 0; config->outputs[i] != NULL; ++i) ++ { ++ GnomeOutputInfo *output = config->outputs[i]; ++ ++ if (output->connected && !output->on) ++ { ++ output->x = last_x; ++ last_x = output->x + output->width; ++ } ++ } ++ + g_assert (gnome_rr_config_match (config, config)); + + return config; +@@ -1025,6 +1054,8 @@ apply_configuration (GnomeRRConfig *conf, GnomeRRScreen *screen) + + crtc_assignment_free (assignment); + ++ gdk_flush (); ++ + return TRUE; + } + +@@ -1034,22 +1065,26 @@ apply_configuration (GnomeRRConfig *conf, GnomeRRScreen *screen) + gboolean + gnome_rr_config_apply_stored (GnomeRRScreen *screen) + { +- GnomeRRConfig **configs = configurations_read (NULL); /* NULL-GError */ ++ GnomeRRConfig **configs; + GnomeRRConfig *current; + GnomeRRConfig *found; + gboolean result = TRUE; + + if (!screen) + return FALSE; +- ++ ++ configs = configurations_read (NULL); /* NULL-GError */ ++ + gnome_rr_screen_refresh (screen); + + current = gnome_rr_config_new_current (screen); ++ + if (configs) + { + if ((found = gnome_rr_config_find (configs, current))) + { + apply_configuration (found, screen); ++ + result = TRUE; + } + else +@@ -1104,16 +1139,14 @@ can_clone (CrtcInfo *info, + } + + static gboolean +-crtc_assignment_assign (CrtcAssignment *assign, +- GnomeRRCrtc *crtc, +- GnomeRRMode *mode, +- int x, +- int y, +- GnomeRRRotation rotation, +- GnomeRROutput *output) ++crtc_assignment_assign (CrtcAssignment *assign, ++ GnomeRRCrtc *crtc, ++ GnomeRRMode *mode, ++ int x, ++ int y, ++ 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 (!gnome_rr_crtc_can_drive_output (crtc, output) || +@@ -1221,98 +1254,6 @@ crtc_is_rotated (GnomeRRCrtc *crtc) + return FALSE; + } + +-static void +-crtc_assignment_apply (CrtcAssignment *assign) +-{ +- GList *active_crtcs = g_hash_table_get_keys (assign->info); +- GnomeRRCrtc **all_crtcs = gnome_rr_screen_list_crtcs (assign->screen); +- GList *list; +- int width, height; +- int i; +- int min_width, max_width, min_height, max_height; +- int width_mm, height_mm; +- +- /* Compute size of the screen */ +- width = height = 1; +- for (list = active_crtcs; list != NULL; list = list->next) +- { +- GnomeRRCrtc *crtc = list->data; +- CrtcInfo *info = g_hash_table_lookup (assign->info, crtc); +- int w, h; +- +- w = gnome_rr_mode_get_width (info->mode); +- h = gnome_rr_mode_get_height (info->mode); +- +- if (mode_is_rotated (info)) +- { +- int tmp = h; +- h = w; +- w = tmp; +- } +- +- width = MAX (width, info->x + w); +- height = MAX (height, info->y + h); +- } +- g_list_free (active_crtcs); +- +- gnome_rr_screen_get_ranges ( +- assign->screen, &min_width, &max_width, &min_height, &max_height); +- +- width = MAX (min_width, width); +- width = MIN (max_width, width); +- height = MAX (min_height, height); +- height = MIN (max_height, height); +- +- /* Turn off all crtcs currently displaying outside the new screen */ +- for (i = 0; all_crtcs[i] != NULL; ++i) +- { +- GnomeRRCrtc *crtc = all_crtcs[i]; +- GnomeRRMode *mode = gnome_rr_crtc_get_current_mode (crtc); +- int x, y; +- +- if (mode) +- { +- int w, h; +- gnome_rr_crtc_get_position (crtc, &x, &y); +- +- w = gnome_rr_mode_get_width (mode); +- h = gnome_rr_mode_get_height (mode); +- +- if (crtc_is_rotated (crtc)) +- { +- int tmp = h; +- h = w; +- w = tmp; +- } +- +- if (x + w > width || y + h > height) +- 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) +- { +- GnomeRRCrtc *crtc = all_crtcs[i]; +- +- if (!g_hash_table_lookup (assign->info, crtc)) +- 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 +- * can consist of many monitors. So just pick a size that make the +- * dpi 96. +- * +- * Firefox and Evince apparently believe what X tells them. +- */ +- width_mm = (width / 96.0) * 25.4 + 0.5; +- height_mm = (height / 96.0) * 25.4 + 0.5; +- +- gnome_rr_screen_set_size (assign->screen, width, height, width_mm, height_mm); +- +- g_hash_table_foreach (assign->info, configure_crtc, NULL); +-} +- + /* Check whether the given set of settings can be used + * at the same time -- ie. whether there is an assignment + * of CRTC's to outputs. +@@ -1388,6 +1329,43 @@ crtc_info_free (CrtcInfo *info) + g_free (info); + } + ++static void ++get_required_virtual_size (CrtcAssignment *assign, int *width, int *height) ++{ ++ GList *active_crtcs = g_hash_table_get_keys (assign->info); ++ GList *list; ++ int d; ++ ++ if (!width) ++ width = &d; ++ if (!height) ++ height = &d; ++ ++ /* Compute size of the screen */ ++ *width = *height = 1; ++ for (list = active_crtcs; list != NULL; list = list->next) ++ { ++ GnomeRRCrtc *crtc = list->data; ++ CrtcInfo *info = g_hash_table_lookup (assign->info, crtc); ++ int w, h; ++ ++ w = gnome_rr_mode_get_width (info->mode); ++ h = gnome_rr_mode_get_height (info->mode); ++ ++ if (mode_is_rotated (info)) ++ { ++ int tmp = h; ++ h = w; ++ w = tmp; ++ } ++ ++ *width = MAX (*width, info->x + w); ++ *height = MAX (*height, info->y + h); ++ } ++ ++ g_list_free (active_crtcs); ++} ++ + static CrtcAssignment * + crtc_assignment_new (GnomeRRScreen *screen, GnomeOutputInfo **outputs) + { +@@ -1398,14 +1376,93 @@ crtc_assignment_new (GnomeRRScreen *screen, GnomeOutputInfo **outputs) + + if (real_assign_crtcs (screen, outputs, assignment)) + { ++ int width, height; ++ int min_width, max_width, min_height, max_height; ++ ++ get_required_virtual_size (assignment, &width, &height); ++ ++ gnome_rr_screen_get_ranges ( ++ screen, &min_width, &max_width, &min_height, &max_height); ++ ++ if (width < min_width || width > max_width || ++ height < min_height || height > max_height) ++ { ++ goto fail; ++ } ++ + assignment->screen = screen; + + return assignment; + } +- else +- { +- crtc_assignment_free (assignment); + +- return NULL; ++fail: ++ crtc_assignment_free (assignment); ++ ++ return NULL; ++} ++ ++static void ++crtc_assignment_apply (CrtcAssignment *assign) ++{ ++ GnomeRRCrtc **all_crtcs = gnome_rr_screen_list_crtcs (assign->screen); ++ int width, height; ++ int i; ++ int min_width, max_width, min_height, max_height; ++ int width_mm, height_mm; ++ ++ /* Compute size of the screen */ ++ get_required_virtual_size (assign, &width, &height); ++ ++ gnome_rr_screen_get_ranges ( ++ assign->screen, &min_width, &max_width, &min_height, &max_height); ++ ++ /* We should never get here if the dimensions don't fit in the virtual size, ++ * but just in case we do, fix it up. ++ */ ++ width = MAX (min_width, width); ++ width = MIN (max_width, width); ++ height = MAX (min_height, height); ++ height = MIN (max_height, height); ++ ++ /* Turn off all crtcs that are currently displaying outside the new screen, ++ * or are not used in the new setup ++ */ ++ for (i = 0; all_crtcs[i] != NULL; ++i) ++ { ++ GnomeRRCrtc *crtc = all_crtcs[i]; ++ GnomeRRMode *mode = gnome_rr_crtc_get_current_mode (crtc); ++ int x, y; ++ ++ if (mode) ++ { ++ int w, h; ++ gnome_rr_crtc_get_position (crtc, &x, &y); ++ ++ w = gnome_rr_mode_get_width (mode); ++ h = gnome_rr_mode_get_height (mode); ++ ++ if (crtc_is_rotated (crtc)) ++ { ++ int tmp = h; ++ h = w; ++ w = tmp; ++ } ++ ++ if (x + w > width || y + h > height || !g_hash_table_lookup (assign->info, crtc)) ++ 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 ++ * can consist of many monitors. So just pick a size that make the ++ * dpi 96. ++ * ++ * Firefox and Evince apparently believe what X tells them. ++ */ ++ width_mm = (width / 96.0) * 25.4 + 0.5; ++ height_mm = (height / 96.0) * 25.4 + 0.5; ++ ++ gnome_rr_screen_set_size (assign->screen, width, height, width_mm, height_mm); ++ ++ g_hash_table_foreach (assign->info, configure_crtc, NULL); + } +diff --git a/libgnome-desktop/gnome-rr-labeler.c b/libgnome-desktop/gnome-rr-labeler.c +new file mode 100644 +index 0000000..a12caec +--- /dev/null ++++ b/libgnome-desktop/gnome-rr-labeler.c +@@ -0,0 +1,366 @@ ++/* gnome-rr-labeler.c - Utility to label monitors to identify them ++ * while they are being configured. ++ * ++ * Copyright 2008, Novell, 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: Federico Mena-Quintero ++ */ ++ ++#define GNOME_DESKTOP_USE_UNSTABLE_API ++ ++#include ++#include "libgnomeui/gnome-rr-labeler.h" ++#include ++ ++struct _GnomeRRLabeler { ++ GObject parent; ++ ++ GnomeRRConfig *config; ++ ++ int num_outputs; ++ ++ GdkColor *palette; ++ GtkWidget **windows; ++}; ++ ++struct _GnomeRRLabelerClass { ++ GObjectClass parent_class; ++}; ++ ++G_DEFINE_TYPE (GnomeRRLabeler, gnome_rr_labeler, G_TYPE_OBJECT); ++ ++static void gnome_rr_labeler_finalize (GObject *object); ++ ++static void ++gnome_rr_labeler_init (GnomeRRLabeler *labeler) ++{ ++ /* nothing */ ++} ++ ++static void ++gnome_rr_labeler_class_init (GnomeRRLabelerClass *class) ++{ ++ GObjectClass *object_class; ++ ++ object_class = (GObjectClass *) class; ++ ++ object_class->finalize = gnome_rr_labeler_finalize; ++} ++ ++static void ++gnome_rr_labeler_finalize (GObject *object) ++{ ++ GnomeRRLabeler *labeler; ++ ++ labeler = GNOME_RR_LABELER (object); ++ ++ /* We don't destroy the labeler->config (a GnomeRRConfig*) here; let our ++ * caller do that instead. ++ */ ++ ++ if (labeler->windows != NULL) { ++ gnome_rr_labeler_hide (labeler); ++ g_free (labeler->windows); ++ labeler->windows = NULL; ++ } ++ ++ g_free (labeler->palette); ++ labeler->palette = NULL; ++ ++ G_OBJECT_CLASS (gnome_rr_labeler_parent_class)->finalize (object); ++} ++ ++static int ++count_outputs (GnomeRRConfig *config) ++{ ++ int i; ++ ++ for (i = 0; config->outputs[i] != NULL; i++) ++ ; ++ ++ return i; ++} ++ ++/* hsv_to_rgb() stolen from gtk+/gtk/gtkhsv.c, sigh. */ ++ ++#define INTENSITY(r, g, b) ((r) * 0.30 + (g) * 0.59 + (b) * 0.11) ++ ++/* Converts from HSV to RGB */ ++static void ++hsv_to_rgb (gdouble *h, ++ gdouble *s, ++ gdouble *v) ++{ ++ gdouble hue, saturation, value; ++ gdouble f, p, q, t; ++ ++ if (*s == 0.0) ++ { ++ *h = *v; ++ *s = *v; ++ *v = *v; /* heh */ ++ } ++ else ++ { ++ hue = *h * 6.0; ++ saturation = *s; ++ value = *v; ++ ++ if (hue == 6.0) ++ hue = 0.0; ++ ++ f = hue - (int) hue; ++ p = value * (1.0 - saturation); ++ q = value * (1.0 - saturation * f); ++ t = value * (1.0 - saturation * (1.0 - f)); ++ ++ switch ((int) hue) ++ { ++ case 0: ++ *h = value; ++ *s = t; ++ *v = p; ++ break; ++ ++ case 1: ++ *h = q; ++ *s = value; ++ *v = p; ++ break; ++ ++ case 2: ++ *h = p; ++ *s = value; ++ *v = t; ++ break; ++ ++ case 3: ++ *h = p; ++ *s = q; ++ *v = value; ++ break; ++ ++ case 4: ++ *h = t; ++ *s = p; ++ *v = value; ++ break; ++ ++ case 5: ++ *h = value; ++ *s = p; ++ *v = q; ++ break; ++ ++ default: ++ g_assert_not_reached (); ++ } ++ } ++} ++ ++static void ++make_palette (GnomeRRLabeler *labeler) ++{ ++ /* The idea is that we go around an hue color wheel. We want to start ++ * at red, go around to green/etc. and stop at blue --- because magenta ++ * is evil. Eeeeek, no magenta, please! ++ * ++ * Purple would be nice, though. Remember that we are watered down ++ * (i.e. low saturation), so that would be like Like berries with cream. ++ * Mmmmm, berries. ++ */ ++ double start_hue; ++ double end_hue; ++ int i; ++ ++ g_assert (labeler->num_outputs > 0); ++ ++ labeler->palette = g_new (GdkColor, labeler->num_outputs); ++ ++ start_hue = 0.0; /* red */ ++ end_hue = 2.0/3; /* blue */ ++ ++ for (i = 0; i < labeler->num_outputs; i++) { ++ double h, s, v; ++ ++ h = start_hue + (end_hue - start_hue) / labeler->num_outputs * i; ++ s = 1.0 / 3; ++ v = 1.0; ++ ++ hsv_to_rgb (&h, &s, &v); ++ ++ labeler->palette[i].red = (int) (65535 * h + 0.5); ++ labeler->palette[i].green = (int) (65535 * s + 0.5); ++ labeler->palette[i].blue = (int) (65535 * v + 0.5); ++ } ++} ++ ++#define LABEL_WINDOW_EDGE_THICKNESS 2 ++#define LABEL_WINDOW_PADDING 12 ++ ++static gboolean ++label_window_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data) ++{ ++ cairo_t *cr; ++ GdkColor *color; ++ ++ color = g_object_get_data (G_OBJECT (widget), "color"); ++ ++ cr = gdk_cairo_create (widget->window); ++ ++ /* edge outline */ ++ ++ cairo_set_source_rgb (cr, 0, 0, 0); ++ cairo_rectangle (cr, ++ LABEL_WINDOW_EDGE_THICKNESS / 2.0, ++ LABEL_WINDOW_EDGE_THICKNESS / 2.0, ++ widget->allocation.width - LABEL_WINDOW_EDGE_THICKNESS, ++ widget->allocation.height - LABEL_WINDOW_EDGE_THICKNESS); ++ cairo_set_line_width (cr, LABEL_WINDOW_EDGE_THICKNESS); ++ cairo_stroke (cr); ++ ++ /* fill */ ++ ++ gdk_cairo_set_source_color (cr, color); ++ cairo_rectangle (cr, ++ LABEL_WINDOW_EDGE_THICKNESS, ++ LABEL_WINDOW_EDGE_THICKNESS, ++ widget->allocation.width - LABEL_WINDOW_EDGE_THICKNESS * 2, ++ widget->allocation.height - LABEL_WINDOW_EDGE_THICKNESS * 2); ++ cairo_fill (cr); ++ ++ cairo_destroy (cr); ++ ++ return FALSE; ++} ++ ++static GtkWidget * ++create_label_window (GnomeRRLabeler *labeler, GnomeOutputInfo *output, GdkColor *color) ++{ ++ GtkWidget *window; ++ GtkWidget *widget; ++ char *str; ++ ++ window = gtk_window_new (GTK_WINDOW_POPUP); ++ GTK_WIDGET_SET_FLAGS (window, GTK_APP_PAINTABLE); ++ ++ gtk_container_set_border_width (GTK_CONTAINER (window), LABEL_WINDOW_PADDING + LABEL_WINDOW_EDGE_THICKNESS); ++ ++ /* This is semi-dangerous. The color is part of the labeler->palette ++ * array. Note that in gnome_rr_labeler_finalize(), we are careful to ++ * free the palette only after we free the windows. ++ */ ++ g_object_set_data (G_OBJECT (window), "color", color); ++ ++ g_signal_connect (window, "expose-event", ++ G_CALLBACK (label_window_expose_event_cb), labeler); ++ ++ str = g_strdup_printf ("%s", output->display_name); ++ widget = gtk_label_new (NULL); ++ gtk_label_set_markup (GTK_LABEL (widget), str); ++ g_free (str); ++ ++ gtk_container_add (GTK_CONTAINER (window), widget); ++ ++ /* Should we center this at the top edge of the monitor, instead of using the upper-left corner? */ ++ gtk_window_move (GTK_WINDOW (window), output->x, output->y); ++ ++ gtk_widget_show_all (window); ++ ++ return window; ++} ++ ++static void ++create_label_windows (GnomeRRLabeler *labeler) ++{ ++ int i; ++ ++ /* FIXME: this doesn't handle cloned outputs yet */ ++ ++ labeler->windows = g_new (GtkWidget *, labeler->num_outputs); ++ ++ for (i = 0; i < labeler->num_outputs; i++) { ++ if (labeler->config->outputs[i]->on) { ++ labeler->windows[i] = create_label_window (labeler, labeler->config->outputs[i], labeler->palette + i); ++ } else ++ labeler->windows[i] = NULL; ++ } ++} ++ ++static void ++setup_from_config (GnomeRRLabeler *labeler) ++{ ++ labeler->num_outputs = count_outputs (labeler->config); ++ ++ make_palette (labeler); ++ ++ create_label_windows (labeler); ++} ++ ++GnomeRRLabeler * ++gnome_rr_labeler_new (GnomeRRConfig *config) ++{ ++ GnomeRRLabeler *labeler; ++ ++ g_return_val_if_fail (config != NULL, NULL); ++ ++ labeler = g_object_new (GNOME_TYPE_RR_LABELER, NULL); ++ labeler->config = config; ++ ++ setup_from_config (labeler); ++ ++ return labeler; ++} ++ ++void ++gnome_rr_labeler_hide (GnomeRRLabeler *labeler) ++{ ++ int i; ++ ++ g_return_if_fail (GNOME_IS_RR_LABELER (labeler)); ++ ++ for (i = 0; i < labeler->num_outputs; i++) ++ if (labeler->windows[i] != NULL) { ++ gtk_widget_destroy (labeler->windows[i]); ++ labeler->windows[i] = NULL; ++ } ++} ++ ++void ++gnome_rr_labeler_get_color_for_output (GnomeRRLabeler *labeler, GnomeOutputInfo *output, GdkColor *color_out) ++{ ++ int i; ++ ++ g_return_if_fail (GNOME_IS_RR_LABELER (labeler)); ++ g_return_if_fail (output != NULL); ++ g_return_if_fail (color_out != NULL); ++ ++ for (i = 0; i < labeler->num_outputs; i++) ++ if (labeler->config->outputs[i] == output) { ++ *color_out = labeler->palette[i]; ++ return; ++ } ++ ++ g_warning ("trying to get the color for unknown GnomeOutputInfo %p; returning magenta!", output); ++ ++ color_out->red = 0xffff; ++ color_out->green = 0; ++ color_out->blue = 0xffff; ++} +diff --git a/libgnome-desktop/gnome-rr.c b/libgnome-desktop/gnome-rr.c +index bd507c7..ccbfe0d 100644 +--- a/libgnome-desktop/gnome-rr.c ++++ b/libgnome-desktop/gnome-rr.c +@@ -440,8 +440,10 @@ gnome_rr_screen_new (GdkScreen *gdk_screen, + + screen->info = screen_info_new (screen); + +- if (!screen->info) ++ if (!screen->info) { ++ g_free (screen); + return NULL; ++ } + + XRRSelectInput (screen->xdisplay, + screen->xroot, +@@ -462,6 +464,19 @@ gnome_rr_screen_new (GdkScreen *gdk_screen, + } + + void ++gnome_rr_screen_destroy (GnomeRRScreen *screen) ++{ ++ g_return_if_fail (screen != NULL); ++ ++ gdk_window_remove_filter (screen->gdk_root, screen_on_event, screen); ++ ++ screen_info_free (screen->info); ++ screen->info = NULL; ++ ++ g_free (screen); ++} ++ ++void + gnome_rr_screen_set_size (GnomeRRScreen *screen, + int width, + int height, +diff --git a/libgnome-desktop/libgnomeui/Makefile.am b/libgnome-desktop/libgnomeui/Makefile.am +index eb5b510..195bad2 100644 +--- a/libgnome-desktop/libgnomeui/Makefile.am ++++ b/libgnome-desktop/libgnomeui/Makefile.am +@@ -4,4 +4,5 @@ libgnomeui_desktop_HEADERS = \ + gnome-hint.h \ + gnome-bg.h \ + gnome-rr.h \ +- gnome-rr-config.h ++ gnome-rr-config.h \ ++ gnome-rr-labeler.h +diff --git a/libgnome-desktop/libgnomeui/gnome-rr-labeler.h b/libgnome-desktop/libgnomeui/gnome-rr-labeler.h +new file mode 100644 +index 0000000..5b751cc +--- /dev/null ++++ b/libgnome-desktop/libgnomeui/gnome-rr-labeler.h +@@ -0,0 +1,53 @@ ++/* gnome-rr-labeler.h - Utility to label monitors to identify them ++ * while they are being configured. ++ * ++ * Copyright 2008, Novell, 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: Federico Mena-Quintero ++ */ ++ ++#ifndef GNOME_RR_LABELER_H ++#define GNOME_RR_LABELER_H ++ ++#ifndef GNOME_DESKTOP_USE_UNSTABLE_API ++#error GnomeRR is unstable API. You must define GNOME_DESKTOP_USE_UNSTABLE_API before including gnomerr.h ++#endif ++ ++#include ++ ++#define GNOME_TYPE_RR_LABELER (gnome_rr_labeler_get_type ()) ++#define GNOME_RR_LABELER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_RR_LABELER, GnomeRRLabeler)) ++#define GNOME_RR_LABELER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_RR_LABELER, GnomeRRLabelerClass)) ++#define GNOME_IS_RR_LABELER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_RR_LABELER)) ++#define GNOME_IS_RR_LABELER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_RR_LABELER)) ++#define GNOME_RR_LABELER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_RR_LABELER, GnomeRRLabelerClass)) ++ ++typedef struct _GnomeRRLabeler GnomeRRLabeler; ++typedef struct _GnomeRRLabelerClass GnomeRRLabelerClass; ++ ++GType gnome_rr_labeler_get_type (void); ++ ++GnomeRRLabeler *gnome_rr_labeler_new (GnomeRRConfig *config); ++ ++void gnome_rr_labeler_hide (GnomeRRLabeler *labeler); ++ ++void gnome_rr_labeler_get_color_for_output (GnomeRRLabeler *labeler, GnomeOutputInfo *output, GdkColor *color_out); ++ ++#endif +diff --git a/libgnome-desktop/libgnomeui/gnome-rr.h b/libgnome-desktop/libgnomeui/gnome-rr.h +index 5dffc01..01b4f45 100644 +--- a/libgnome-desktop/libgnomeui/gnome-rr.h ++++ b/libgnome-desktop/libgnomeui/gnome-rr.h +@@ -52,6 +52,7 @@ typedef enum + GnomeRRScreen * gnome_rr_screen_new (GdkScreen *screen, + GnomeRRScreenChanged callback, + gpointer data); ++void gnome_rr_screen_destroy (GnomeRRScreen *screen); + GnomeRROutput **gnome_rr_screen_list_outputs (GnomeRRScreen *screen); + GnomeRRCrtc ** gnome_rr_screen_list_crtcs (GnomeRRScreen *screen); + GnomeRRMode ** gnome_rr_screen_list_modes (GnomeRRScreen *screen); diff --git a/gnome-desktop.changes b/gnome-desktop.changes index 7f369c2..f5d1bda 100644 --- a/gnome-desktop.changes +++ b/gnome-desktop.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Aug 15 18:16:06 CEST 2008 - federico@novell.com + +- Added gnome-desktop-randr-monitor-labeling.diff. This implements an + API to label physical monitors while their RANDR options are being + configured. + ------------------------------------------------------------------- Tue Aug 5 18:43:47 CEST 2008 - rodrigo@suse.de diff --git a/gnome-desktop.spec b/gnome-desktop.spec index d40185a..8978cca 100644 --- a/gnome-desktop.spec +++ b/gnome-desktop.spec @@ -24,7 +24,7 @@ License: GNU Free Documentation License, Version 1.1 (GFDL 1.1); GPL v2 o Group: System/GUI/GNOME Obsoletes: gnome-core Version: 2.23.6 -Release: 1 +Release: 3 Summary: The GNOME Desktop API Library Source: %{name}-%{version}.tar.bz2 Url: http://www.gnome.org @@ -36,6 +36,8 @@ Patch2: gnome-desktop-desktop.patch Patch3: gnome-desktop-recently-used-apps.patch # PATCH-FEATURE-OPENSUSE gnome-desktop-fate300461-desktop-gettext.patch fate300461 vuntz@novell.com -- Look for translation of desktop entry strings via gettext Patch5: gnome-desktop-fate300461-desktop-gettext.patch +# PATCH-FEATURE-UPSTREAM gnome-desktop-randr-monitor-labeling.diff fate304764 federico@novell.com - Label physical monitors while settings their RANDR configuration +Patch6: gnome-desktop-randr-monitor-labeling.diff Requires: %{name}-lang = %{version} Requires: libgnome-desktop-2-7 = %{version} @@ -131,6 +133,7 @@ Authors: %patch2 -p0 %patch3 -p1 %patch5 -p1 +%patch6 -p1 %build autoreconf -f -i @@ -189,6 +192,10 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/gtk-doc/html/gnome-desktop %changelog +* Fri Aug 15 2008 federico@novell.com +- Added gnome-desktop-randr-monitor-labeling.diff. This implements an + API to label physical monitors while their RANDR options are being + configured. * Tue Aug 05 2008 rodrigo@suse.de - Update to version 2.23.6: + Fix build with gcc 2.x (Jens Granseuer)