From a0da3060df54a69f38b76dfd52c137700bdac96e Mon Sep 17 00:00:00 2001 From: Laurent Napias Date: Sat, 29 Jun 2019 12:02:22 +0200 Subject: Remove trailing whitespaces --- libmate-desktop/mate-colorbutton.c | 122 +++---- libmate-desktop/mate-colorsel.c | 454 +++++++++++++------------- libmate-desktop/mate-colorseldialog.c | 14 +- libmate-desktop/mate-dconf.c | 4 +- libmate-desktop/mate-desktop-thumbnail.c | 82 ++--- libmate-desktop/mate-gsettings.c | 2 +- libmate-desktop/mate-hsv.c | 76 ++--- libmate-desktop/mate-rr-config.c | 146 ++++----- libmate-desktop/mate-rr-config.h | 8 +- libmate-desktop/mate-rr-private.h | 8 +- libmate-desktop/mate-rr.c | 234 ++++++------- libmate-desktop/mate-rr.h | 8 +- libmate-desktop/mate-thumbnail-pixbuf-utils.c | 16 +- libmate-desktop/test.c | 2 +- tools/mate-color-select.c | 2 +- 15 files changed, 589 insertions(+), 589 deletions(-) diff --git a/libmate-desktop/mate-colorbutton.c b/libmate-desktop/mate-colorbutton.c index c4eee8b..249860a 100644 --- a/libmate-desktop/mate-colorbutton.c +++ b/libmate-desktop/mate-colorbutton.c @@ -25,7 +25,7 @@ * Modified by the GTK+ Team and others 2003. See the AUTHORS * file for a list of people on the GTK+ Team. See the ChangeLog * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ #include "config.h" @@ -44,21 +44,21 @@ #define CHECK_DARK (1.0 / 3.0) #define CHECK_LIGHT (2.0 / 3.0) -struct _MateColorButtonPrivate +struct _MateColorButtonPrivate { GtkWidget *draw_area; /* Widget where we draw the color sample */ GtkWidget *cs_dialog; /* Color selection dialog */ - + gchar *title; /* Title for the color selection window */ - + GdkColor color; guint16 alpha; - + guint use_alpha : 1; /* Use alpha or not */ }; /* Properties */ -enum +enum { PROP_0, PROP_USE_ALPHA, @@ -68,7 +68,7 @@ enum }; /* Signals */ -enum +enum { COLOR_SET, LAST_SIGNAL @@ -86,7 +86,7 @@ static void mate_color_button_get_property (GObject *object, GParamSpec *pspec); /* gtkwidget signals */ -static void mate_color_button_state_changed (GtkWidget *widget, +static void mate_color_button_state_changed (GtkWidget *widget, GtkStateType previous_state); /* gtkbutton signals */ @@ -141,15 +141,15 @@ mate_color_button_class_init (MateColorButtonClass *klass) /** * MateColorButton:use-alpha: * - * If this property is set to %TRUE, the color swatch on the button is rendered against a - * checkerboard background to show its opacity and the opacity slider is displayed in the - * color selection dialog. + * If this property is set to %TRUE, the color swatch on the button is rendered against a + * checkerboard background to show its opacity and the opacity slider is displayed in the + * color selection dialog. * * Since: 1.9.1 */ g_object_class_install_property (gobject_class, PROP_USE_ALPHA, - g_param_spec_boolean ("use-alpha", _("Use alpha"), + g_param_spec_boolean ("use-alpha", _("Use alpha"), _("Whether or not to give the color an alpha value"), FALSE, G_PARAM_READWRITE)); @@ -163,8 +163,8 @@ mate_color_button_class_init (MateColorButtonClass *klass) */ g_object_class_install_property (gobject_class, PROP_TITLE, - g_param_spec_string ("title", - _("Title"), + g_param_spec_string ("title", + _("Title"), _("The title of the color selection dialog"), _("Pick a Color"), G_PARAM_READWRITE)); @@ -187,7 +187,7 @@ mate_color_button_class_init (MateColorButtonClass *klass) /** * MateColorButton:alpha: * - * The selected opacity value (0 fully transparent, 65535 fully opaque). + * The selected opacity value (0 fully transparent, 65535 fully opaque). * * Since: 1.9.1 */ @@ -198,13 +198,13 @@ mate_color_button_class_init (MateColorButtonClass *klass) _("The selected opacity value (0 fully transparent, 65535 fully opaque)"), 0, 65535, 65535, G_PARAM_READWRITE)); - + /** * MateColorButton::color-set: * @widget: the object which received the signal. - * - * The ::color-set signal is emitted when the user selects a color. - * When handling this signal, use mate_color_button_get_color() and + * + * The ::color-set signal is emitted when the user selects a color. + * When handling this signal, use mate_color_button_get_color() and * mate_color_button_get_alpha() to find out which color was just selected. * * Note that this signal is only emitted when the user @@ -254,8 +254,8 @@ mate_color_button_get_checkered (void) /* Handle exposure events for the color picker's drawing area */ static gboolean -draw (GtkWidget *widget, - cairo_t *cr, +draw (GtkWidget *widget, + cairo_t *cr, gpointer data) { MateColorButton *color_button = MATE_COLOR_BUTTON (data); @@ -302,7 +302,7 @@ draw (GtkWidget *widget, } static void -mate_color_button_state_changed (GtkWidget *widget, +mate_color_button_state_changed (GtkWidget *widget, GtkStateType previous_state) { gtk_widget_queue_draw (widget); @@ -326,7 +326,7 @@ mate_color_button_drag_data_received (GtkWidget *widget, /* We accept drops with the wrong format, since the KDE color * chooser incorrectly drops application/x-color with format 8. */ - if (gtk_selection_data_get_length (selection_data) != 8) + if (gtk_selection_data_get_length (selection_data) != 8) { g_warning (_("Received invalid color data\n")); return; @@ -360,12 +360,12 @@ set_color_icon (GdkDragContext *context, pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 48, 32); - pixel = ((color->red & 0xff00) << 16) | - ((color->green & 0xff00) << 8) | + pixel = ((color->red & 0xff00) << 16) | + ((color->green & 0xff00) << 8) | (color->blue & 0xff00); gdk_pixbuf_fill (pixbuf, pixel); - + gtk_drag_set_icon_pixbuf (context, pixbuf, -2, -2); g_object_unref (pixbuf); } @@ -376,7 +376,7 @@ mate_color_button_drag_begin (GtkWidget *widget, gpointer data) { MateColorButton *color_button = data; - + set_color_icon (context, &color_button->priv->color); } @@ -482,9 +482,9 @@ mate_color_button_finalize (GObject *object) * mate_color_button_new: * * Creates a new color button. This returns a widget in the form of - * a small button containing a swatch representing the current selected - * color. When the button is clicked, a color-selection dialog will open, - * allowing the user to select a color. The swatch will be updated to reflect + * a small button containing a swatch representing the current selected + * color. When the button is clicked, a color-selection dialog will open, + * allowing the user to select a color. The swatch will be updated to reflect * the new color when the user finishes. * * Returns: a new color button. @@ -501,7 +501,7 @@ mate_color_button_new (void) * mate_color_button_new_with_color: * @color: A #GdkColor to set the current color with. * - * Creates a new color button. + * Creates a new color button. * * Returns: a new color button. * @@ -514,7 +514,7 @@ mate_color_button_new_with_color (const GdkColor *color) } static void -dialog_ok_clicked (GtkWidget *widget, +dialog_ok_clicked (GtkWidget *widget, gpointer data) { MateColorButton *color_button = MATE_COLOR_BUTTON (data); @@ -538,11 +538,11 @@ dialog_ok_clicked (GtkWidget *widget, } static gboolean -dialog_destroy (GtkWidget *widget, +dialog_destroy (GtkWidget *widget, gpointer data) { MateColorButton *color_button = MATE_COLOR_BUTTON (data); - + color_button->priv->cs_dialog = NULL; return FALSE; @@ -553,8 +553,8 @@ dialog_cancel_clicked (GtkWidget *widget, gpointer data) { MateColorButton *color_button = MATE_COLOR_BUTTON (data); - - gtk_widget_hide (color_button->priv->cs_dialog); + + gtk_widget_hide (color_button->priv->cs_dialog); } static void @@ -564,26 +564,26 @@ mate_color_button_clicked (GtkButton *button) MateColorSelectionDialog *color_dialog; /* if dialog already exists, make sure it's shown and raised */ - if (!color_button->priv->cs_dialog) + if (!color_button->priv->cs_dialog) { /* Create the dialog and connects its buttons */ GtkWidget *parent; - + parent = gtk_widget_get_toplevel (GTK_WIDGET (color_button)); - + color_button->priv->cs_dialog = mate_color_selection_dialog_new (color_button->priv->title); - + color_dialog = MATE_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog); if (gtk_widget_is_toplevel (parent) && GTK_IS_WINDOW (parent)) { if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (color_dialog))) gtk_window_set_transient_for (GTK_WINDOW (color_dialog), GTK_WINDOW (parent)); - + gtk_window_set_modal (GTK_WINDOW (color_dialog), gtk_window_get_modal (GTK_WINDOW (parent))); } - + g_signal_connect (color_dialog->ok_button, "clicked", G_CALLBACK (dialog_ok_clicked), color_button); g_signal_connect (color_dialog->cancel_button, "clicked", @@ -598,15 +598,15 @@ mate_color_button_clicked (GtkButton *button) color_button->priv->use_alpha); mate_color_selection_set_has_palette (MATE_COLOR_SELECTION (color_dialog->colorsel), TRUE); - - mate_color_selection_set_previous_color (MATE_COLOR_SELECTION (color_dialog->colorsel), + + mate_color_selection_set_previous_color (MATE_COLOR_SELECTION (color_dialog->colorsel), &color_button->priv->color); - mate_color_selection_set_previous_alpha (MATE_COLOR_SELECTION (color_dialog->colorsel), + mate_color_selection_set_previous_alpha (MATE_COLOR_SELECTION (color_dialog->colorsel), color_button->priv->alpha); - mate_color_selection_set_current_color (MATE_COLOR_SELECTION (color_dialog->colorsel), + mate_color_selection_set_current_color (MATE_COLOR_SELECTION (color_dialog->colorsel), &color_button->priv->color); - mate_color_selection_set_current_alpha (MATE_COLOR_SELECTION (color_dialog->colorsel), + mate_color_selection_set_current_alpha (MATE_COLOR_SELECTION (color_dialog->colorsel), color_button->priv->alpha); gtk_window_present (GTK_WINDOW (color_button->priv->cs_dialog)); @@ -633,7 +633,7 @@ mate_color_button_set_color (MateColorButton *color_button, color_button->priv->color.blue = color->blue; gtk_widget_queue_draw (color_button->priv->draw_area); - + g_object_notify (G_OBJECT (color_button), "color"); } @@ -659,7 +659,7 @@ mate_color_button_set_rgba (MateColorButton *color_button, color_button->priv->alpha = color->alpha * 65535; gtk_widget_queue_draw (color_button->priv->draw_area); - + g_object_notify (G_OBJECT (color_button), "color"); } @@ -668,7 +668,7 @@ mate_color_button_set_rgba (MateColorButton *color_button, * @color_button: a #MateColorButton. * @alpha: an integer between 0 and 65535. * - * Sets the current opacity to be @alpha. + * Sets the current opacity to be @alpha. * * Since: 1.9.1 **/ @@ -699,7 +699,7 @@ mate_color_button_get_color (MateColorButton *color_button, GdkColor *color) { g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button)); - + color->red = color_button->priv->color.red; color->green = color_button->priv->color.green; color->blue = color_button->priv->color.blue; @@ -719,7 +719,7 @@ mate_color_button_get_rgba (MateColorButton *color_button, GdkRGBA *color) { g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button)); - + color->red = color_button->priv->color.red / 65535.; color->green = color_button->priv->color.green / 65535.; color->blue = color_button->priv->color.blue / 65535.; @@ -730,7 +730,7 @@ mate_color_button_get_rgba (MateColorButton *color_button, * mate_color_button_get_alpha: * @color_button: a #MateColorButton. * - * Returns the current alpha value. + * Returns the current alpha value. * * Return value: an integer between 0 and 65535. * @@ -740,7 +740,7 @@ guint16 mate_color_button_get_alpha (MateColorButton *color_button) { g_return_val_if_fail (MATE_IS_COLOR_BUTTON (color_button), 0); - + return color_button->priv->alpha; } @@ -754,14 +754,14 @@ mate_color_button_get_alpha (MateColorButton *color_button) * Since: 1.9.1 */ void -mate_color_button_set_use_alpha (MateColorButton *color_button, +mate_color_button_set_use_alpha (MateColorButton *color_button, gboolean use_alpha) { g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button)); use_alpha = (use_alpha != FALSE); - if (color_button->priv->use_alpha != use_alpha) + if (color_button->priv->use_alpha != use_alpha) { color_button->priv->use_alpha = use_alpha; @@ -800,7 +800,7 @@ mate_color_button_get_use_alpha (MateColorButton *color_button) * Since: 1.9.1 */ void -mate_color_button_set_title (MateColorButton *color_button, +mate_color_button_set_title (MateColorButton *color_button, const gchar *title) { gchar *old_title; @@ -812,9 +812,9 @@ mate_color_button_set_title (MateColorButton *color_button, g_free (old_title); if (color_button->priv->cs_dialog) - gtk_window_set_title (GTK_WINDOW (color_button->priv->cs_dialog), + gtk_window_set_title (GTK_WINDOW (color_button->priv->cs_dialog), color_button->priv->title); - + g_object_notify (G_OBJECT (color_button), "title"); } @@ -844,7 +844,7 @@ mate_color_button_set_property (GObject *object, { MateColorButton *color_button = MATE_COLOR_BUTTON (object); - switch (param_id) + switch (param_id) { case PROP_USE_ALPHA: mate_color_button_set_use_alpha (color_button, g_value_get_boolean (value)); @@ -873,7 +873,7 @@ mate_color_button_get_property (GObject *object, MateColorButton *color_button = MATE_COLOR_BUTTON (object); GdkColor color; - switch (param_id) + switch (param_id) { case PROP_USE_ALPHA: g_value_set_boolean (value, mate_color_button_get_use_alpha (color_button)); diff --git a/libmate-desktop/mate-colorsel.c b/libmate-desktop/mate-colorsel.c index d66ee37..05a6fd8 100644 --- a/libmate-desktop/mate-colorsel.c +++ b/libmate-desktop/mate-colorsel.c @@ -22,7 +22,7 @@ * Modified by the GTK+ Team and others 1997-2001. See the AUTHORS * file for a list of people on the GTK+ Team. See the ChangeLog * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ #include "config.h" @@ -55,7 +55,7 @@ #define SAMPLE_WIDTH 64 #define SAMPLE_HEIGHT 28 -#define CHECK_SIZE 16 +#define CHECK_SIZE 16 #define BIG_STEP 20 /* Conversion between 0->1 double and and guint16. See @@ -98,10 +98,10 @@ struct _MateColorSelectionPrivate guint default_set : 1; guint default_alpha_set : 1; guint has_grab : 1; - + gdouble color[COLORSEL_NUM_CHANNELS]; gdouble old_color[COLORSEL_NUM_CHANNELS]; - + GtkWidget *triangle_colorsel; GtkWidget *hue_spinbutton; GtkWidget *sat_spinbutton; @@ -114,10 +114,10 @@ struct _MateColorSelectionPrivate GtkWidget *opacity_entry; GtkWidget *palette_frame; GtkWidget *hex_entry; - + /* The Palette code */ GtkWidget *custom_palette [GTK_CUSTOM_PALETTE_WIDTH][GTK_CUSTOM_PALETTE_HEIGHT]; - + /* The color_sample stuff */ GtkWidget *sample_area; GtkWidget *old_sample; @@ -176,7 +176,7 @@ static void opacity_entry_changed (GtkWidget *opacity_ent gpointer data); static void hex_changed (GtkWidget *hex_entry, gpointer data); -static gboolean hex_focus_out (GtkWidget *hex_entry, +static gboolean hex_focus_out (GtkWidget *hex_entry, GdkEventFocus *event, gpointer data); static void color_sample_new (MateColorSelection *colorsel); @@ -253,7 +253,7 @@ mate_color_selection_class_init (MateColorSelectionClass *klass) { GObjectClass *gobject_class; GtkWidgetClass *widget_class; - + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = mate_color_selection_finalize; gobject_class->set_property = mate_color_selection_set_property; @@ -266,7 +266,7 @@ mate_color_selection_class_init (MateColorSelectionClass *klass) widget_class->unrealize = mate_color_selection_unrealize; widget_class->show_all = mate_color_selection_show_all; widget_class->grab_broken_event = mate_color_selection_grab_broken; - + g_object_class_install_property (gobject_class, PROP_HAS_OPACITY_CONTROL, g_param_spec_boolean ("has-opacity-control", @@ -326,17 +326,17 @@ mate_color_selection_init (MateColorSelection *colorsel) MateColorSelectionPrivate *priv; AtkObject *atk_obj; GList *focus_chain = NULL; - + _mate_desktop_init_i18n (); priv = colorsel->private_data = mate_color_selection_get_instance_private (colorsel); priv->changing = FALSE; priv->default_set = FALSE; priv->default_alpha_set = FALSE; - + top_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_box_pack_start (GTK_BOX (colorsel), top_hbox, FALSE, FALSE, 0); - + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); priv->triangle_colorsel = mate_hsv_new (); g_signal_connect (priv->triangle_colorsel, "changed", @@ -346,21 +346,21 @@ mate_color_selection_init (MateColorSelection *colorsel) gtk_box_pack_start (GTK_BOX (vbox), priv->triangle_colorsel, FALSE, FALSE, 0); gtk_widget_set_tooltip_text (priv->triangle_colorsel, _("Select the color you want from the outer ring. Select the darkness or lightness of that color using the inner triangle.")); - + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); - + frame = gtk_frame_new (NULL); gtk_widget_set_size_request (frame, -1, 30); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); color_sample_new (colorsel); gtk_container_add (GTK_CONTAINER (frame), priv->sample_area); gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0); - + button = gtk_button_new (); gtk_widget_set_events (button, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK); - g_object_set_data (G_OBJECT (button), "COLORSEL", colorsel); + g_object_set_data (G_OBJECT (button), "COLORSEL", colorsel); g_signal_connect (button, "clicked", G_CALLBACK (get_screen_color), NULL); picker_image = gtk_image_new_from_icon_name ("gtk-color-picker", GTK_ICON_SIZE_BUTTON); @@ -370,14 +370,14 @@ mate_color_selection_init (MateColorSelection *colorsel) gtk_widget_set_tooltip_text (button, _("Click the eyedropper, then click a color anywhere on your screen to select that color.")); - + top_right_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (top_hbox), top_right_vbox, FALSE, FALSE, 0); grid = gtk_grid_new (); gtk_box_pack_start (GTK_BOX (top_right_vbox), grid, FALSE, FALSE, 0); gtk_grid_set_row_spacing (GTK_GRID (grid), 6); gtk_grid_set_column_spacing (GTK_GRID (grid), 12); - + make_label_spinbutton (colorsel, &priv->hue_spinbutton, _("_Hue:"), grid, 0, 0, COLORSEL_HUE, _("Position on the color wheel.")); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (priv->hue_spinbutton), TRUE); @@ -391,13 +391,13 @@ mate_color_selection_init (MateColorSelection *colorsel) _("Amount of green light in the color.")); make_label_spinbutton (colorsel, &priv->blue_spinbutton, _("_Blue:"), grid, 6, 2, COLORSEL_BLUE, _("Amount of blue light in the color.")); - gtk_grid_attach (GTK_GRID (grid), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), 0, 3, 8, 1); + gtk_grid_attach (GTK_GRID (grid), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), 0, 3, 8, 1); priv->opacity_label = gtk_label_new_with_mnemonic (_("Op_acity:")); gtk_label_set_xalign (GTK_LABEL (priv->opacity_label), 0.0); - gtk_grid_attach (GTK_GRID (grid), priv->opacity_label, 0, 4, 1, 1); - adjust = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 255.0, 1.0, 1.0, 0.0)); - g_object_set_data (G_OBJECT (adjust), "COLORSEL", colorsel); + gtk_grid_attach (GTK_GRID (grid), priv->opacity_label, 0, 4, 1, 1); + adjust = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 255.0, 1.0, 1.0, 0.0)); + g_object_set_data (G_OBJECT (adjust), "COLORSEL", colorsel); priv->opacity_slider = gtk_hscale_new (adjust); gtk_widget_set_tooltip_text (priv->opacity_slider, _("Transparency of the color.")); @@ -407,16 +407,16 @@ mate_color_selection_init (MateColorSelection *colorsel) g_signal_connect (adjust, "value-changed", G_CALLBACK (adjustment_changed), GINT_TO_POINTER (COLORSEL_OPACITY)); - gtk_grid_attach (GTK_GRID (grid), priv->opacity_slider, 1, 4, 6, 1); - priv->opacity_entry = gtk_entry_new (); + gtk_grid_attach (GTK_GRID (grid), priv->opacity_slider, 1, 4, 6, 1); + priv->opacity_entry = gtk_entry_new (); gtk_widget_set_tooltip_text (priv->opacity_entry, _("Transparency of the color.")); - gtk_widget_set_size_request (priv->opacity_entry, 40, -1); + gtk_widget_set_size_request (priv->opacity_entry, 40, -1); g_signal_connect (priv->opacity_entry, "activate", G_CALLBACK (opacity_entry_changed), colorsel); gtk_grid_attach (GTK_GRID (grid), priv->opacity_entry, 7, 4, 1, 1); - + label = gtk_label_new_with_mnemonic (_("Color _name:")); gtk_grid_attach (GTK_GRID (grid), label, 0, 5, 1, 1); gtk_label_set_xalign (GTK_LABEL (label), 0.0); @@ -432,7 +432,7 @@ mate_color_selection_init (MateColorSelection *colorsel) gtk_widget_set_tooltip_text (priv->hex_entry, _("You can enter an HTML-style hexadecimal color value, or simply a color name such as 'orange' in this entry.")); - + gtk_entry_set_width_chars (GTK_ENTRY (priv->hex_entry), 7); gtk_grid_attach (GTK_GRID (grid), priv->hex_entry, 1, 5, 4, 1); @@ -468,21 +468,21 @@ mate_color_selection_init (MateColorSelection *colorsel) gtk_label_set_mnemonic_widget (GTK_LABEL (label), priv->custom_palette[0][0]); - + gtk_box_pack_end (GTK_BOX (top_right_vbox), priv->palette_frame, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (priv->palette_frame), grid, FALSE, FALSE, 0); - + gtk_widget_show_all (top_hbox); /* hide unused stuff */ - + if (priv->has_opacity == FALSE) { gtk_widget_hide (priv->opacity_label); gtk_widget_hide (priv->opacity_slider); gtk_widget_hide (priv->opacity_entry); } - + if (priv->has_palette == FALSE) { gtk_widget_hide (priv->palette_frame); @@ -494,7 +494,7 @@ mate_color_selection_init (MateColorSelection *colorsel) atk_object_set_name (atk_obj, _("Color Wheel")); atk_object_set_role (gtk_widget_get_accessible (GTK_WIDGET (colorsel)), ATK_ROLE_COLOR_CHOOSER); make_all_relations (atk_obj, priv); - } + } } /* GObject methods */ @@ -511,15 +511,15 @@ mate_color_selection_set_property (GObject *object, GParamSpec *pspec) { MateColorSelection *colorsel = MATE_COLOR_SELECTION (object); - + switch (prop_id) { case PROP_HAS_OPACITY_CONTROL: - mate_color_selection_set_has_opacity_control (colorsel, + mate_color_selection_set_has_opacity_control (colorsel, g_value_get_boolean (value)); break; case PROP_HAS_PALETTE: - mate_color_selection_set_has_palette (colorsel, + mate_color_selection_set_has_palette (colorsel, g_value_get_boolean (value)); break; case PROP_CURRENT_COLOR: @@ -532,7 +532,7 @@ mate_color_selection_set_property (GObject *object, G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } - + } static void @@ -544,7 +544,7 @@ mate_color_selection_get_property (GObject *object, MateColorSelection *colorsel = MATE_COLOR_SELECTION (object); MateColorSelectionPrivate *priv = colorsel->private_data; GdkColor color; - + switch (prop_id) { case PROP_HAS_OPACITY_CONTROL: @@ -624,7 +624,7 @@ mate_color_selection_show_all (GtkWidget *widget) gtk_widget_show (widget); } -static gboolean +static gboolean mate_color_selection_grab_broken (GtkWidget *widget, GdkEventGrabBroken *event) { @@ -648,7 +648,7 @@ set_color_internal (MateColorSelection *colorsel, { MateColorSelectionPrivate *priv; gint i; - + priv = colorsel->private_data; priv->changing = TRUE; priv->color[COLORSEL_RED] = color[0]; @@ -686,7 +686,7 @@ set_color_icon (GdkDragContext *context, ((UNSCALE (colors[COLORSEL_BLUE]) & 0xff00))); gdk_pixbuf_fill (pixbuf, pixel); - + gtk_drag_set_icon_pixbuf (context, pixbuf, -2, -2); g_object_unref (pixbuf); } @@ -699,9 +699,9 @@ color_sample_drag_begin (GtkWidget *widget, MateColorSelection *colorsel = data; MateColorSelectionPrivate *priv; gdouble *colsrc; - + priv = colorsel->private_data; - + if (widget == priv->old_sample) colsrc = priv->old_color; else @@ -733,17 +733,17 @@ color_sample_drop_handle (GtkWidget *widget, guint16 *vals; gdouble color[4]; priv = colorsel->private_data; - + /* This is currently a guint16 array of the format: * R * G * B * opacity */ - + if (gtk_selection_data_get_length (selection_data) < 0) return; - + /* We accept drops with the wrong format, since the KDE color * chooser incorrectly drops application/x-color with format 8. */ @@ -752,16 +752,16 @@ color_sample_drop_handle (GtkWidget *widget, g_warning ("Received invalid color data\n"); return; } - + vals = (guint16 *) gtk_selection_data_get_data (selection_data); - + if (widget == priv->cur_sample) { color[0] = (gdouble)vals[0] / 0xffff; color[1] = (gdouble)vals[1] / 0xffff; color[2] = (gdouble)vals[2] / 0xffff; color[3] = (gdouble)vals[3] / 0xffff; - + set_color_internal (colorsel, color); } } @@ -778,19 +778,19 @@ color_sample_drag_handle (GtkWidget *widget, MateColorSelectionPrivate *priv; guint16 vals[4]; gdouble *colsrc; - + priv = colorsel->private_data; - + if (widget == priv->old_sample) colsrc = priv->old_color; else colsrc = priv->color; - + vals[0] = colsrc[COLORSEL_RED] * 0xffff; vals[1] = colsrc[COLORSEL_GREEN] * 0xffff; vals[2] = colsrc[COLORSEL_BLUE] * 0xffff; vals[3] = priv->has_opacity ? colsrc[COLORSEL_OPACITY] * 0xffff : 0xffff; - + gtk_selection_data_set (selection_data, gdk_atom_intern_static_string ("application/x-color"), 16, (guchar *)vals, 8); @@ -804,10 +804,10 @@ color_sample_draw_sample (MateColorSelection *colorsel, cairo_t *cr, int which) gint x, y, wid, heig, goff; MateColorSelectionPrivate *priv; GtkAllocation allocation; - + g_return_if_fail (colorsel != NULL); priv = colorsel->private_data; - + g_return_if_fail (priv->sample_area != NULL); if (!gtk_widget_is_drawable (priv->sample_area)) return; @@ -828,8 +828,8 @@ color_sample_draw_sample (MateColorSelection *colorsel, cairo_t *cr, int which) wid = allocation.width; heig = allocation.height; - /* Below needs tweaking for non-power-of-two */ - + /* Below needs tweaking for non-power-of-two */ + if (priv->has_opacity) { /* Draw checks in background */ @@ -849,8 +849,8 @@ color_sample_draw_sample (MateColorSelection *colorsel, cairo_t *cr, int which) if (which == 0) { cairo_set_source_rgba (cr, - priv->old_color[COLORSEL_RED], - priv->old_color[COLORSEL_GREEN], + priv->old_color[COLORSEL_RED], + priv->old_color[COLORSEL_GREEN], priv->old_color[COLORSEL_BLUE], priv->has_opacity ? priv->old_color[COLORSEL_OPACITY] : 1.0); @@ -858,8 +858,8 @@ color_sample_draw_sample (MateColorSelection *colorsel, cairo_t *cr, int which) else { cairo_set_source_rgba (cr, - priv->color[COLORSEL_RED], - priv->color[COLORSEL_GREEN], + priv->color[COLORSEL_RED], + priv->color[COLORSEL_GREEN], priv->color[COLORSEL_BLUE], priv->has_opacity ? priv->color[COLORSEL_OPACITY] : 1.0); @@ -905,37 +905,37 @@ color_sample_setup_dnd (MateColorSelection *colorsel, GtkWidget *sample) }; MateColorSelectionPrivate *priv; priv = colorsel->private_data; - + gtk_drag_source_set (sample, GDK_BUTTON1_MASK | GDK_BUTTON3_MASK, targets, 1, GDK_ACTION_COPY | GDK_ACTION_MOVE); - + g_signal_connect (sample, "drag-begin", G_CALLBACK (color_sample_drag_begin), colorsel); if (sample == priv->cur_sample) { - + gtk_drag_dest_set (sample, GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, targets, 1, GDK_ACTION_COPY); - + g_signal_connect (sample, "drag-end", G_CALLBACK (color_sample_drag_end), colorsel); } - + g_signal_connect (sample, "drag-data-get", G_CALLBACK (color_sample_drag_handle), colorsel); g_signal_connect (sample, "drag-data-received", G_CALLBACK (color_sample_drop_handle), colorsel); - + } static void @@ -967,7 +967,7 @@ static void color_sample_new (MateColorSelection *colorsel) { MateColorSelectionPrivate *priv; - + priv = colorsel->private_data; priv->sample_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); @@ -978,14 +978,14 @@ color_sample_new (MateColorSelection *colorsel) TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (priv->sample_area), priv->cur_sample, TRUE, TRUE, 0); - + g_signal_connect (priv->old_sample, "draw", G_CALLBACK (color_old_sample_draw), colorsel); g_signal_connect (priv->cur_sample, "draw", G_CALLBACK (color_cur_sample_draw), colorsel); - + color_sample_setup_dnd (colorsel, priv->old_sample); color_sample_setup_dnd (colorsel, priv->cur_sample); @@ -1005,9 +1005,9 @@ static void palette_get_color (GtkWidget *drawing_area, gdouble *color) { gdouble *color_val; - + g_return_if_fail (color != NULL); - + color_val = g_object_get_data (G_OBJECT (drawing_area), "color_val"); if (color_val == NULL) { @@ -1018,7 +1018,7 @@ palette_get_color (GtkWidget *drawing_area, gdouble *color) color[3] = 1.0; return; } - + color[0] = color_val[0]; color[1] = color_val[1]; color[2] = color_val[2]; @@ -1032,7 +1032,7 @@ palette_paint (GtkWidget *drawing_area, { gint focus_width; GtkAllocation allocation; - + if (gtk_widget_get_window (drawing_area) == NULL) return; @@ -1061,12 +1061,12 @@ set_focus_line_attributes (GtkWidget *drawing_area, { gdouble color[4]; gint8 *dash_list; - + gtk_widget_style_get (drawing_area, "focus-line-width", focus_width, "focus-line-pattern", (gchar *)&dash_list, NULL); - + palette_get_color (drawing_area, color); if (INTENSITY (color[0], color[1], color[2]) > 0.5) @@ -1098,7 +1098,7 @@ set_focus_line_attributes (GtkWidget *drawing_area, dash_offset = - *focus_width / 2.; while (dash_offset < 0) dash_offset += total_length; - + cairo_set_dash (cr, dashes, n_dashes, dash_offset); g_free (dashes); } @@ -1112,7 +1112,7 @@ palette_drag_begin (GtkWidget *widget, gpointer data) { gdouble colors[4]; - + palette_get_color (widget, colors); set_color_icon (context, colors); } @@ -1127,14 +1127,14 @@ palette_drag_handle (GtkWidget *widget, { guint16 vals[4]; gdouble colsrc[4]; - + palette_get_color (widget, colsrc); - + vals[0] = colsrc[COLORSEL_RED] * 0xffff; vals[1] = colsrc[COLORSEL_GREEN] * 0xffff; vals[2] = colsrc[COLORSEL_BLUE] * 0xffff; vals[3] = 0xffff; - + gtk_selection_data_set (selection_data, gdk_atom_intern_static_string ("application/x-color"), 16, (guchar *)vals, 8); @@ -1160,7 +1160,7 @@ get_current_colors (MateColorSelection *colorsel) /* make sure that we fill every slot */ g_assert (n_colors == GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT); - + return colors; } @@ -1178,9 +1178,9 @@ palette_change_color (GtkWidget *drawing_area, g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel)); g_return_if_fail (GTK_IS_DRAWING_AREA (drawing_area)); - + priv = colorsel->private_data; - + gdk_color.red = UNSCALE (color[0]); gdk_color.green = UNSCALE (color[1]); gdk_color.blue = UNSCALE (color[2]); @@ -1195,7 +1195,7 @@ palette_change_color (GtkWidget *drawing_area, { if (priv->custom_palette[x][y] == drawing_area) goto out; - + ++y; } @@ -1203,7 +1203,7 @@ palette_change_color (GtkWidget *drawing_area, } out: - + g_assert (x < GTK_CUSTOM_PALETTE_WIDTH || y < GTK_CUSTOM_PALETTE_HEIGHT); current_colors = get_current_colors (colorsel); @@ -1211,17 +1211,17 @@ palette_change_color (GtkWidget *drawing_area, screen = gtk_widget_get_screen (GTK_WIDGET (colorsel)); if (change_palette_hook != default_change_palette_func) - (* change_palette_hook) (screen, current_colors, + (* change_palette_hook) (screen, current_colors, GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT); else if (noscreen_change_palette_hook != default_noscreen_change_palette_func) { if (screen != gdk_screen_get_default ()) g_warning ("mate_color_selection_set_change_palette_hook used by widget is not on the default screen."); - (* noscreen_change_palette_hook) (current_colors, + (* noscreen_change_palette_hook) (current_colors, GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT); } else - (* change_palette_hook) (screen, current_colors, + (* change_palette_hook) (screen, current_colors, GTK_CUSTOM_PALETTE_WIDTH * GTK_CUSTOM_PALETTE_HEIGHT); g_free (current_colors); @@ -1255,14 +1255,14 @@ palette_set_color (GtkWidget *drawing_area, { gdouble *new_color = g_new (double, 4); GdkRGBA box_color; - + box_color.red = color[0]; box_color.green = color[1]; box_color.blue = color[2]; box_color.alpha = 1; override_background_color (drawing_area, &box_color); - + if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (drawing_area), "color_set")) == 0) { static const GtkTargetEntry targets[] = { @@ -1272,14 +1272,14 @@ palette_set_color (GtkWidget *drawing_area, GDK_BUTTON1_MASK | GDK_BUTTON3_MASK, targets, 1, GDK_ACTION_COPY | GDK_ACTION_MOVE); - + g_signal_connect (drawing_area, "drag-begin", G_CALLBACK (palette_drag_begin), colorsel); g_signal_connect (drawing_area, "drag-data-get", G_CALLBACK (palette_drag_handle), colorsel); - + g_object_set_data (G_OBJECT (drawing_area), "color_set", GINT_TO_POINTER (1)); } @@ -1288,7 +1288,7 @@ palette_set_color (GtkWidget *drawing_area, new_color[1] = color[1]; new_color[2] = color[2]; new_color[3] = 1.0; - + g_object_set_data_full (G_OBJECT (drawing_area), "color_val", new_color, (GDestroyNotify)g_free); } @@ -1313,17 +1313,17 @@ popup_position_func (GtkMenu *menu, gpointer user_data) { GtkWidget *widget; - GtkRequisition req; + GtkRequisition req; gint root_x, root_y; GdkScreen *screen; GtkAllocation allocation; - + widget = GTK_WIDGET (user_data); - + g_return_if_fail (gtk_widget_get_realized (widget)); gdk_window_get_origin (gtk_widget_get_window (widget), &root_x, &root_y); - + gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL); /* Put corner of menu centered on color cell */ @@ -1346,13 +1346,13 @@ save_color_selected (GtkWidget *menuitem, MateColorSelectionPrivate *priv; drawing_area = GTK_WIDGET (data); - + colorsel = MATE_COLOR_SELECTION (g_object_get_data (G_OBJECT (drawing_area), "gtk-color-sel")); priv = colorsel->private_data; - - palette_change_color (drawing_area, colorsel, priv->color); + + palette_change_color (drawing_area, colorsel, priv->color); } static void @@ -1362,11 +1362,11 @@ do_popup (MateColorSelection *colorsel, { GtkWidget *menu; GtkWidget *mi; - + g_object_set_data (G_OBJECT (drawing_area), _("gtk-color-sel"), colorsel); - + menu = gtk_menu_new (); mi = gtk_menu_item_new_with_mnemonic (_("_Save color here")); @@ -1374,7 +1374,7 @@ do_popup (MateColorSelection *colorsel, g_signal_connect (mi, "activate", G_CALLBACK (save_color_selected), drawing_area); - + gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); gtk_widget_show_all (mi); @@ -1485,10 +1485,10 @@ palette_drop_handle (GtkWidget *widget, MateColorSelection *colorsel = MATE_COLOR_SELECTION (data); guint16 *vals; gdouble color[4]; - + if (gtk_selection_data_get_length (selection_data) < 0) return; - + /* We accept drops with the wrong format, since the KDE color * chooser incorrectly drops application/x-color with format 8. */ @@ -1497,9 +1497,9 @@ palette_drop_handle (GtkWidget *widget, g_warning ("Received invalid color data\n"); return; } - + vals = (guint16 *) gtk_selection_data_get_data (selection_data); - + color[0] = (gdouble)vals[0] / 0xffff; color[1] = (gdouble)vals[1] / 0xffff; color[2] = (gdouble)vals[2] / 0xffff; @@ -1528,7 +1528,7 @@ palette_activate (GtkWidget *widget, } return TRUE; } - + return FALSE; } @@ -1541,7 +1541,7 @@ palette_popup (GtkWidget *widget, do_popup (colorsel, widget, GDK_CURRENT_TIME); return TRUE; } - + static GtkWidget* palette_new (MateColorSelection *colorsel) @@ -1554,7 +1554,7 @@ palette_new (MateColorSelection *colorsel) gtk_widget_set_can_focus (retval, TRUE); - g_object_set_data (G_OBJECT (retval), "color_set", GINT_TO_POINTER (0)); + g_object_set_data (G_OBJECT (retval), "color_set", GINT_TO_POINTER (0)); gtk_widget_set_events (retval, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_EXPOSURE_MASK @@ -1623,7 +1623,7 @@ make_picker_cursor (GdkScreen *screen) DROPPER_X_HOT, DROPPER_Y_HOT); g_object_unref (pixbuf); } - + return cursor; } @@ -1639,7 +1639,7 @@ grab_color_at_mouse (GdkScreen *screen, MateColorSelectionPrivate *priv; GdkColor color; GdkWindow *root_window = gdk_screen_get_root_window (screen); - + priv = colorsel->private_data; pixbuf = gdk_pixbuf_get_from_window (root_window, @@ -1667,7 +1667,7 @@ grab_color_at_mouse (GdkScreen *screen, priv->color[COLORSEL_RED] = SCALE (color.red); priv->color[COLORSEL_GREEN] = SCALE (color.green); priv->color[COLORSEL_BLUE] = SCALE (color.blue); - + gtk_rgb_to_hsv (priv->color[COLORSEL_RED], priv->color[COLORSEL_GREEN], priv->color[COLORSEL_BLUE], @@ -1686,7 +1686,7 @@ shutdown_eyedropper (GtkWidget *widget) GdkDisplay *display = gtk_widget_get_display (widget); colorsel = MATE_COLOR_SELECTION (widget); - priv = colorsel->private_data; + priv = colorsel->private_data; if (priv->has_grab) { @@ -1704,7 +1704,7 @@ mouse_motion (GtkWidget *invisible, gpointer data) { grab_color_at_mouse (gdk_event_get_screen ((GdkEvent *)event), - event->x_root, event->y_root, data); + event->x_root, event->y_root, data); } static gboolean @@ -1721,7 +1721,7 @@ mouse_release (GtkWidget *invisible, event->x_root, event->y_root, data); shutdown_eyedropper (GTK_WIDGET (data)); - + g_signal_handlers_disconnect_by_func (invisible, mouse_motion, data); @@ -1738,7 +1738,7 @@ static gboolean key_press (GtkWidget *invisible, GdkEventKey *event, gpointer data) -{ +{ GdkDisplay *display = gtk_widget_get_display (invisible); GdkScreen *screen = gdk_event_get_screen ((GdkEvent *)event); guint state = event->state & gtk_accelerator_get_default_mod_mask (); @@ -1750,7 +1750,7 @@ key_press (GtkWidget *invisible, dx = 0; dy = 0; - switch (event->keyval) + switch (event->keyval) { case GDK_KEY_space: case GDK_KEY_Return: @@ -1762,14 +1762,14 @@ key_press (GtkWidget *invisible, case GDK_KEY_Escape: shutdown_eyedropper (data); - + g_signal_handlers_disconnect_by_func (invisible, mouse_press, data); g_signal_handlers_disconnect_by_func (invisible, key_press, data); - + return TRUE; #if defined GDK_WINDOWING_X11 @@ -1799,7 +1799,7 @@ key_press (GtkWidget *invisible, } gdk_display_warp_pointer (display, screen, x + dx, y + dy); - + return TRUE; } @@ -1810,7 +1810,7 @@ mouse_press (GtkWidget *invisible, gpointer data) { /* MateColorSelection *colorsel = data; */ - + if (event->type == GDK_BUTTON_PRESS && event->button == 1) { @@ -1844,7 +1844,7 @@ get_screen_color (GtkWidget *button) GtkWidget *grab_widget, *toplevel; guint32 time = gtk_get_current_event_time (); - + if (priv->dropper_grab_widget == NULL) { grab_widget = gtk_window_new (GTK_WINDOW_POPUP); @@ -1855,13 +1855,13 @@ get_screen_color (GtkWidget *button) gtk_widget_add_events (grab_widget, GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK); - + toplevel = gtk_widget_get_toplevel (GTK_WIDGET (colorsel)); - + if (GTK_IS_WINDOW (toplevel)) { if (gtk_window_get_group (GTK_WINDOW (toplevel))) - gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)), + gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)), GTK_WINDOW (grab_widget)); } @@ -1871,7 +1871,7 @@ get_screen_color (GtkWidget *button) if (gdk_keyboard_grab (gtk_widget_get_window (priv->dropper_grab_widget), FALSE, time) != GDK_GRAB_SUCCESS) return; - + picker_cursor = make_picker_cursor (screen); grab_status = gdk_pointer_grab (gtk_widget_get_window (priv->dropper_grab_widget), FALSE, @@ -1880,7 +1880,7 @@ get_screen_color (GtkWidget *button) picker_cursor, time); g_object_unref (picker_cursor); - + if (grab_status != GDK_GRAB_SUCCESS) { gdk_display_keyboard_ungrab (gtk_widget_get_display (button), time); @@ -1890,7 +1890,7 @@ get_screen_color (GtkWidget *button) gtk_grab_add (priv->dropper_grab_widget); priv->grab_time = time; priv->has_grab = TRUE; - + g_signal_connect (priv->dropper_grab_widget, "button-press-event", G_CALLBACK (mouse_press), colorsel); g_signal_connect (priv->dropper_grab_widget, "key-press-event", @@ -1905,13 +1905,13 @@ hex_changed (GtkWidget *hex_entry, MateColorSelectionPrivate *priv; GdkColor color; gchar *text; - + colorsel = MATE_COLOR_SELECTION (data); priv = colorsel->private_data; - + if (priv->changing) return; - + text = gtk_editable_get_chars (GTK_EDITABLE (priv->hex_entry), 0, -1); if (gdk_color_parse (text, &color)) { @@ -1930,12 +1930,12 @@ hex_changed (GtkWidget *hex_entry, } static gboolean -hex_focus_out (GtkWidget *hex_entry, +hex_focus_out (GtkWidget *hex_entry, GdkEventFocus *event, gpointer data) { hex_changed (hex_entry, data); - + return FALSE; } @@ -1945,13 +1945,13 @@ hsv_changed (GtkWidget *hsv, { MateColorSelection *colorsel; MateColorSelectionPrivate *priv; - + colorsel = MATE_COLOR_SELECTION (data); priv = colorsel->private_data; - + if (priv->changing) return; - + mate_hsv_get_color (MATE_HSV (hsv), &priv->color[COLORSEL_HUE], &priv->color[COLORSEL_SATURATION], @@ -1972,14 +1972,14 @@ adjustment_changed (GtkAdjustment *adjustment, MateColorSelection *colorsel; MateColorSelectionPrivate *priv; gdouble value; - + colorsel = MATE_COLOR_SELECTION (g_object_get_data (G_OBJECT (adjustment), "COLORSEL")); priv = colorsel->private_data; value = gtk_adjustment_get_value (adjustment); - + if (priv->changing) return; - + switch (GPOINTER_TO_INT (data)) { case COLORSEL_SATURATION: @@ -2005,7 +2005,7 @@ adjustment_changed (GtkAdjustment *adjustment, case COLORSEL_GREEN: case COLORSEL_BLUE: priv->color[GPOINTER_TO_INT (data)] = value / 255; - + gtk_rgb_to_hsv (priv->color[COLORSEL_RED], priv->color[COLORSEL_GREEN], priv->color[COLORSEL_BLUE], @@ -2020,7 +2020,7 @@ adjustment_changed (GtkAdjustment *adjustment, update_color (colorsel); } -static void +static void opacity_entry_changed (GtkWidget *opacity_entry, gpointer data) { @@ -2028,19 +2028,19 @@ opacity_entry_changed (GtkWidget *opacity_entry, MateColorSelectionPrivate *priv; GtkAdjustment *adj; gchar *text; - + colorsel = MATE_COLOR_SELECTION (data); priv = colorsel->private_data; - + if (priv->changing) return; - + text = gtk_editable_get_chars (GTK_EDITABLE (priv->opacity_entry), 0, -1); adj = gtk_range_get_adjustment (GTK_RANGE (priv->opacity_slider)); - gtk_adjustment_set_value (adj, g_strtod (text, NULL)); - + gtk_adjustment_set_value (adj, g_strtod (text, NULL)); + update_color (colorsel); - + g_free (text); } @@ -2073,7 +2073,7 @@ make_label_spinbutton (MateColorSelection *colorsel, g_object_set_data (G_OBJECT (adjust), "COLORSEL", colorsel); *spinbutton = gtk_spin_button_new (adjust, 10.0, 0); - gtk_widget_set_tooltip_text (*spinbutton, tooltip); + gtk_widget_set_tooltip_text (*spinbutton, tooltip); g_signal_connect (adjust, "value-changed", G_CALLBACK (adjustment_changed), @@ -2094,7 +2094,7 @@ make_palette_frame (MateColorSelection *colorsel, { GtkWidget *frame; MateColorSelectionPrivate *priv; - + priv = colorsel->private_data; frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); @@ -2106,10 +2106,10 @@ make_palette_frame (MateColorSelection *colorsel, } /* Set the palette entry [x][y] to be the currently selected one. */ -static void +static void set_selected_palette (MateColorSelection *colorsel, int x, int y) { - MateColorSelectionPrivate *priv = colorsel->private_data; + MateColorSelectionPrivate *priv = colorsel->private_data; gtk_widget_grab_focus (priv->custom_palette[x][y]); } @@ -2130,10 +2130,10 @@ update_color (MateColorSelection *colorsel) gchar entryval[12]; gchar opacity_text[32]; gchar *ptr; - + priv->changing = TRUE; color_sample_update_samples (colorsel); - + mate_hsv_set_color (MATE_HSV (priv->triangle_colorsel), priv->color[COLORSEL_HUE], priv->color[COLORSEL_SATURATION], @@ -2159,15 +2159,15 @@ update_color (MateColorSelection *colorsel) gtk_adjustment_set_value (gtk_range_get_adjustment (GTK_RANGE (priv->opacity_slider)), scale_round (priv->color[COLORSEL_OPACITY], 255)); - + g_snprintf (opacity_text, 32, "%.0f", scale_round (priv->color[COLORSEL_OPACITY], 255)); gtk_entry_set_text (GTK_ENTRY (priv->opacity_entry), opacity_text); - + g_snprintf (entryval, 11, "#%2X%2X%2X", (guint) (scale_round (priv->color[COLORSEL_RED], 255)), (guint) (scale_round (priv->color[COLORSEL_GREEN], 255)), (guint) (scale_round (priv->color[COLORSEL_BLUE], 255))); - + for (ptr = entryval; *ptr; ptr++) if (*ptr == ' ') *ptr = '0'; @@ -2175,14 +2175,14 @@ update_color (MateColorSelection *colorsel) priv->changing = FALSE; g_object_ref (colorsel); - + g_signal_emit (colorsel, color_selection_signals[COLOR_CHANGED], 0); - + g_object_freeze_notify (G_OBJECT (colorsel)); g_object_notify (G_OBJECT (colorsel), "current-color"); g_object_notify (G_OBJECT (colorsel), "current-alpha"); g_object_thaw_notify (G_OBJECT (colorsel)); - + g_object_unref (colorsel); } @@ -2193,7 +2193,7 @@ update_palette (MateColorSelection *colorsel) gint i, j; current_colors = get_current_colors (colorsel); - + for (i = 0; i < GTK_CUSTOM_PALETTE_HEIGHT; i++) { for (j = 0; j < GTK_CUSTOM_PALETTE_WIDTH; j++) @@ -2201,7 +2201,7 @@ update_palette (MateColorSelection *colorsel) gint index; index = i * GTK_CUSTOM_PALETTE_WIDTH + j; - + mate_color_selection_set_palette_color (colorsel, index, ¤t_colors[index]); @@ -2232,7 +2232,7 @@ default_change_palette_func (GdkScreen *screen, gint n_colors) { gchar *str; - + str = mate_color_selection_palette_to_string (colors, n_colors); gtk_settings_set_string_property (gtk_settings_get_for_screen (screen), @@ -2245,9 +2245,9 @@ default_change_palette_func (GdkScreen *screen, /** * mate_color_selection_new: - * + * * Creates a new MateColorSelection. - * + * * Return value: a new #MateColorSelection **/ GtkWidget * @@ -2260,37 +2260,37 @@ mate_color_selection_new (void) color[1] = 1.0; color[2] = 1.0; color[3] = 1.0; - + colorsel = g_object_new (MATE_TYPE_COLOR_SELECTION, "orientation", GTK_ORIENTATION_VERTICAL, NULL); priv = colorsel->private_data; set_color_internal (colorsel, color); mate_color_selection_set_has_opacity_control (colorsel, TRUE); - + /* We want to make sure that default_set is FALSE */ /* This way the user can still set it */ priv->default_set = FALSE; priv->default_alpha_set = FALSE; - + return GTK_WIDGET (colorsel); } /** * mate_color_selection_get_has_opacity_control: * @colorsel: a #MateColorSelection. - * + * * Determines whether the colorsel has an opacity control. - * + * * Return value: %TRUE if the @colorsel has an opacity control. %FALSE if it does't. **/ gboolean mate_color_selection_get_has_opacity_control (MateColorSelection *colorsel) { MateColorSelectionPrivate *priv; - + g_return_val_if_fail (MATE_IS_COLOR_SELECTION (colorsel), FALSE); - + priv = colorsel->private_data; - + return priv->has_opacity; } @@ -2300,19 +2300,19 @@ mate_color_selection_get_has_opacity_control (MateColorSelection *colorsel) * @has_opacity: %TRUE if @colorsel can set the opacity, %FALSE otherwise. * * Sets the @colorsel to use or not use opacity. - * + * **/ void mate_color_selection_set_has_opacity_control (MateColorSelection *colorsel, gboolean has_opacity) { MateColorSelectionPrivate *priv; - + g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel)); - + priv = colorsel->private_data; has_opacity = has_opacity != FALSE; - + if (priv->has_opacity != has_opacity) { priv->has_opacity = has_opacity; @@ -2329,7 +2329,7 @@ mate_color_selection_set_has_opacity_control (MateColorSelection *colorsel, gtk_widget_hide (priv->opacity_entry); } color_sample_update_samples (colorsel); - + g_object_notify (G_OBJECT (colorsel), "has-opacity-control"); } } @@ -2337,20 +2337,20 @@ mate_color_selection_set_has_opacity_control (MateColorSelection *colorsel, /** * mate_color_selection_get_has_palette: * @colorsel: a #MateColorSelection. - * + * * Determines whether the color selector has a color palette. - * + * * Return value: %TRUE if the selector has a palette. %FALSE if it hasn't. **/ gboolean mate_color_selection_get_has_palette (MateColorSelection *colorsel) { MateColorSelectionPrivate *priv; - + g_return_val_if_fail (MATE_IS_COLOR_SELECTION (colorsel), FALSE); - + priv = colorsel->private_data; - + return priv->has_palette; } @@ -2360,7 +2360,7 @@ mate_color_selection_get_has_palette (MateColorSelection *colorsel) * @has_palette: %TRUE if palette is to be visible, %FALSE otherwise. * * Shows and hides the palette based upon the value of @has_palette. - * + * **/ void mate_color_selection_set_has_palette (MateColorSelection *colorsel, @@ -2368,10 +2368,10 @@ mate_color_selection_set_has_palette (MateColorSelection *colorsel, { MateColorSelectionPrivate *priv; g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel)); - + priv = colorsel->private_data; has_palette = has_palette != FALSE; - + if (priv->has_palette != has_palette) { priv->has_palette = has_palette; @@ -2400,7 +2400,7 @@ mate_color_selection_set_current_color (MateColorSelection *colorsel, { MateColorSelectionPrivate *priv; gint i; - + g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel)); g_return_if_fail (color != NULL); @@ -2438,9 +2438,9 @@ mate_color_selection_set_current_alpha (MateColorSelection *colorsel, { MateColorSelectionPrivate *priv; gint i; - + g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel)); - + priv = colorsel->private_data; priv->changing = TRUE; priv->color[COLORSEL_OPACITY] = SCALE (alpha); @@ -2456,7 +2456,7 @@ mate_color_selection_set_current_alpha (MateColorSelection *colorsel, /** * mate_color_selection_set_color: * @colorsel: a #MateColorSelection. - * @color: an array of 4 doubles specifying the red, green, blue and opacity + * @color: an array of 4 doubles specifying the red, green, blue and opacity * to set the current color to. * * Sets the current color to be @color. The first time this is called, it will @@ -2485,10 +2485,10 @@ mate_color_selection_get_current_color (MateColorSelection *colorsel, GdkColor *color) { MateColorSelectionPrivate *priv; - + g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel)); g_return_if_fail (color != NULL); - + priv = colorsel->private_data; color->red = UNSCALE (priv->color[COLORSEL_RED]); color->green = UNSCALE (priv->color[COLORSEL_GREEN]); @@ -2507,9 +2507,9 @@ guint16 mate_color_selection_get_current_alpha (MateColorSelection *colorsel) { MateColorSelectionPrivate *priv; - + g_return_val_if_fail (MATE_IS_COLOR_SELECTION (colorsel), 0); - + priv = colorsel->private_data; return priv->has_opacity ? UNSCALE (priv->color[COLORSEL_OPACITY]) : 65535; } @@ -2528,9 +2528,9 @@ mate_color_selection_get_color (MateColorSelection *colorsel, gdouble *color) { MateColorSelectionPrivate *priv; - + g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel)); - + priv = colorsel->private_data; color[0] = priv->color[COLORSEL_RED]; color[1] = priv->color[COLORSEL_GREEN]; @@ -2553,10 +2553,10 @@ mate_color_selection_set_previous_color (MateColorSelection *colorsel, const GdkColor *color) { MateColorSelectionPrivate *priv; - + g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel)); g_return_if_fail (color != NULL); - + priv = colorsel->private_data; priv->changing = TRUE; priv->old_color[COLORSEL_RED] = SCALE (color->red); @@ -2586,9 +2586,9 @@ mate_color_selection_set_previous_alpha (MateColorSelection *colorsel, guint16 alpha) { MateColorSelectionPrivate *priv; - + g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel)); - + priv = colorsel->private_data; priv->changing = TRUE; priv->old_color[COLORSEL_OPACITY] = SCALE (alpha); @@ -2610,10 +2610,10 @@ mate_color_selection_get_previous_color (MateColorSelection *colorsel, GdkColor *color) { MateColorSelectionPrivate *priv; - + g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel)); g_return_if_fail (color != NULL); - + priv = colorsel->private_data; color->red = UNSCALE (priv->old_color[COLORSEL_RED]); color->green = UNSCALE (priv->old_color[COLORSEL_GREEN]); @@ -2632,9 +2632,9 @@ guint16 mate_color_selection_get_previous_alpha (MateColorSelection *colorsel) { MateColorSelectionPrivate *priv; - + g_return_val_if_fail (MATE_IS_COLOR_SELECTION (colorsel), 0); - + priv = colorsel->private_data; return priv->has_opacity ? UNSCALE (priv->old_color[COLORSEL_OPACITY]) : 65535; } @@ -2646,7 +2646,7 @@ mate_color_selection_get_previous_alpha (MateColorSelection *colorsel) * @color: A #GdkColor to set the palette with. * * Sets the palette located at @index to have @color as its color. - * + * **/ static void mate_color_selection_set_palette_color (MateColorSelection *colorsel, @@ -2656,18 +2656,18 @@ mate_color_selection_set_palette_color (MateColorSelection *colorsel, MateColorSelectionPrivate *priv; gint x, y; gdouble col[3]; - + g_return_if_fail (MATE_IS_COLOR_SELECTION (colorsel)); g_return_if_fail (index >= 0 && index < GTK_CUSTOM_PALETTE_WIDTH*GTK_CUSTOM_PALETTE_HEIGHT); x = index % GTK_CUSTOM_PALETTE_WIDTH; y = index / GTK_CUSTOM_PALETTE_WIDTH; - + priv = colorsel->private_data; col[0] = SCALE (color->red); col[1] = SCALE (color->green); col[2] = SCALE (color->blue); - + palette_set_color (priv->custom_palette[x][y], colorsel, col); } @@ -2684,11 +2684,11 @@ gboolean mate_color_selection_is_adjusting (MateColorSelection *colorsel) { MateColorSelectionPrivate *priv; - + g_return_val_if_fail (MATE_IS_COLOR_SELECTION (colorsel), FALSE); - + priv = colorsel->private_data; - + return (mate_hsv_is_adjusting (MATE_HSV (priv->triangle_colorsel))); } @@ -2699,10 +2699,10 @@ mate_color_selection_is_adjusting (MateColorSelection *colorsel) * @colors: (out) (array length=n_colors): return location for allocated * array of #GdkColor. * @n_colors: return location for length of array. - * + * * Parses a color palette string; the string is a colon-separated * list of color names readable by gdk_color_parse(). - * + * * Return value: %TRUE if a palette was successfully parsed. **/ gboolean @@ -2715,7 +2715,7 @@ mate_color_selection_palette_from_string (const gchar *str, gchar *p; gchar *start; gchar *copy; - + count = 0; retval = NULL; copy = g_strdup (str); @@ -2732,7 +2732,7 @@ mate_color_selection_palette_from_string (const gchar *str, { goto failed; /* empty entry */ } - + if (*p) { *p = '\0'; @@ -2757,7 +2757,7 @@ mate_color_selection_palette_from_string (const gchar *str, } g_free (copy); - + if (colors) *colors = retval; else @@ -2767,7 +2767,7 @@ mate_color_selection_palette_from_string (const gchar *str, *n_colors = count; return TRUE; - + failed: g_free (copy); g_free (retval); @@ -2784,9 +2784,9 @@ mate_color_selection_palette_from_string (const gchar *str, * mate_color_selection_palette_to_string: * @colors: (array length=n_colors): an array of colors. * @n_colors: length of the array. - * + * * Encodes a palette as a string, useful for persistent storage. - * + * * Return value: allocated string encoding the palette. **/ gchar* @@ -2796,7 +2796,7 @@ mate_color_selection_palette_to_string (const GdkColor *colors, gint i; gchar **strs = NULL; gchar *retval; - + if (n_colors == 0) return g_strdup (""); @@ -2806,7 +2806,7 @@ mate_color_selection_palette_to_string (const GdkColor *colors, while (i < n_colors) { gchar *ptr; - + strs[i] = g_strdup_printf ("#%2X%2X%2X", colors[i].red / 256, @@ -2816,7 +2816,7 @@ mate_color_selection_palette_to_string (const GdkColor *colors, for (ptr = strs[i]; *ptr; ptr++) if (*ptr == ' ') *ptr = '0'; - + ++i; } @@ -2830,7 +2830,7 @@ mate_color_selection_palette_to_string (const GdkColor *colors, /** * mate_color_selection_set_change_palette_hook: * @func: a function to call when the custom palette needs saving. - * + * * Installs a global function to be called whenever the user tries to * modify the palette in a color selection. This function should save * the new palette contents, and update the GtkSettings property @@ -2839,8 +2839,8 @@ mate_color_selection_palette_to_string (const GdkColor *colors, * Return value: the previous change palette hook (that was replaced). * * Deprecated: 2.4: This function does not work in multihead environments. - * Use mate_color_selection_set_change_palette_with_screen_hook() instead. - * + * Use mate_color_selection_set_change_palette_with_screen_hook() instead. + * **/ MateColorSelectionChangePaletteFunc mate_color_selection_set_change_palette_hook (MateColorSelectionChangePaletteFunc func) @@ -2857,12 +2857,12 @@ mate_color_selection_set_change_palette_hook (MateColorSelectionChangePaletteFun /** * mate_color_selection_set_change_palette_with_screen_hook: * @func: a function to call when the custom palette needs saving. - * + * * Installs a global function to be called whenever the user tries to * modify the palette in a color selection. This function should save * the new palette contents, and update the GtkSettings property * "gtk-color-palette" so all MateColorSelection widgets will be modified. - * + * * Return value: the previous change palette hook (that was replaced). * * Since: 1.9.1 diff --git a/libmate-desktop/mate-colorseldialog.c b/libmate-desktop/mate-colorseldialog.c index bfde10d..2516be1 100644 --- a/libmate-desktop/mate-colorseldialog.c +++ b/libmate-desktop/mate-colorseldialog.c @@ -21,7 +21,7 @@ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS * file for a list of people on the GTK+ Team. See the ChangeLog * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ #include "config.h" #include "private.h" @@ -137,11 +137,11 @@ mate_color_selection_dialog_init (MateColorSelectionDialog *colorseldiag) colorseldiag->colorsel = mate_color_selection_new (); gtk_container_set_border_width (GTK_CONTAINER (colorseldiag->colorsel), 5); - mate_color_selection_set_has_palette (MATE_COLOR_SELECTION(colorseldiag->colorsel), FALSE); + mate_color_selection_set_has_palette (MATE_COLOR_SELECTION(colorseldiag->colorsel), FALSE); mate_color_selection_set_has_opacity_control (MATE_COLOR_SELECTION(colorseldiag->colorsel), FALSE); gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (colorseldiag))), colorseldiag->colorsel); gtk_widget_show (colorseldiag->colorsel); - + colorseldiag->cancel_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); @@ -149,9 +149,9 @@ mate_color_selection_dialog_init (MateColorSelectionDialog *colorseldiag) colorseldiag->ok_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag), GTK_STOCK_OK, GTK_RESPONSE_OK); - + gtk_widget_grab_default (colorseldiag->ok_button); - + colorseldiag->help_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag), GTK_STOCK_HELP, GTK_RESPONSE_HELP); @@ -168,14 +168,14 @@ GtkWidget* mate_color_selection_dialog_new (const gchar *title) { MateColorSelectionDialog *colorseldiag; - + colorseldiag = g_object_new (MATE_TYPE_COLOR_SELECTION_DIALOG, NULL); if (title) gtk_window_set_title (GTK_WINDOW (colorseldiag), title); gtk_window_set_resizable (GTK_WINDOW (colorseldiag), FALSE); - + return GTK_WIDGET (colorseldiag); } diff --git a/libmate-desktop/mate-dconf.c b/libmate-desktop/mate-dconf.c index bffafbd..0384193 100644 --- a/libmate-desktop/mate-dconf.c +++ b/libmate-desktop/mate-dconf.c @@ -71,7 +71,7 @@ mate_dconf_write_sync (const gchar *key, * @error: a variable to store the error, or NULL. * * Allow to reset a dconf path. - * + * * Since: 1.7.1 */ gboolean @@ -97,7 +97,7 @@ mate_dconf_recursive_reset (const gchar *dir, * Returns the list of subdirectories of the given dconf directory. * * Return value: the list of subdirectories. - * + * * Since: 1.7.1 */ gchar ** diff --git a/libmate-desktop/mate-desktop-thumbnail.c b/libmate-desktop/mate-desktop-thumbnail.c index 2d718e7..b874070 100644 --- a/libmate-desktop/mate-desktop-thumbnail.c +++ b/libmate-desktop/mate-desktop-thumbnail.c @@ -251,21 +251,21 @@ get_thumbnailers_dirs (void) } static void -size_prepared_cb (GdkPixbufLoader *loader, +size_prepared_cb (GdkPixbufLoader *loader, int width, int height, gpointer data) { SizePrepareContext *info = data; - + g_return_if_fail (width > 0 && height > 0); - + info->input_width = width; info->input_height = height; - + if (width < info->width && height < info->height) return; - - if (info->preserve_aspect_ratio && + + if (info->preserve_aspect_ratio && (info->width > 0 || info->height > 0)) { if (info->width < 0) { @@ -291,7 +291,7 @@ size_prepared_cb (GdkPixbufLoader *loader, if (info->height > 0) height = info->height; } - + gdk_pixbuf_loader_set_size (loader, width, height); } @@ -336,7 +336,7 @@ _gdk_pixbuf_new_from_uri_at_scale (const char *uri, guchar buffer[LOAD_BUFFER_SIZE]; gsize bytes_read; GdkPixbufLoader *loader = NULL; - GdkPixbuf *pixbuf; + GdkPixbuf *pixbuf; GdkPixbufAnimation *animation; GdkPixbufAnimationIter *iter; gboolean has_frame; @@ -467,7 +467,7 @@ mate_desktop_thumbnail_factory_finalize (GObject *object) { MateDesktopThumbnailFactory *factory; MateDesktopThumbnailFactoryPrivate *priv; - + factory = MATE_DESKTOP_THUMBNAIL_FACTORY (object); priv = factory->priv; @@ -773,13 +773,13 @@ static void mate_desktop_thumbnail_factory_init (MateDesktopThumbnailFactory *factory) { MateDesktopThumbnailFactoryPrivate *priv; - + factory->priv = mate_desktop_thumbnail_factory_get_instance_private (factory); priv = factory->priv; priv->size = MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL; - + priv->mime_types_map = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify)g_free, @@ -811,7 +811,7 @@ mate_desktop_thumbnail_factory_class_init (MateDesktopThumbnailFactoryClass *cla GObjectClass *gobject_class; gobject_class = G_OBJECT_CLASS (class); - + gobject_class->finalize = mate_desktop_thumbnail_factory_finalize; } @@ -822,7 +822,7 @@ mate_desktop_thumbnail_factory_class_init (MateDesktopThumbnailFactoryClass *cla * Creates a new #MateDesktopThumbnailFactory. * * This function must be called on the main thread. - * + * * Return value: a new #MateDesktopThumbnailFactory * * Since: 2.2 @@ -831,11 +831,11 @@ MateDesktopThumbnailFactory * mate_desktop_thumbnail_factory_new (MateDesktopThumbnailSize size) { MateDesktopThumbnailFactory *factory; - + factory = g_object_new (MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY, NULL); - + factory->priv->size = size; - + return factory; } @@ -877,7 +877,7 @@ mate_desktop_thumbnail_factory_lookup (MateDesktopThumbnailFactory *factory, g_assert (digest_len == 16); file = g_strconcat (g_checksum_get_string (checksum), ".png", NULL); - + path = g_build_filename (g_get_user_cache_dir (), "thumbnails", (priv->size == MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL)?"normal":"large", @@ -1060,7 +1060,7 @@ mate_desktop_thumbnail_factory_can_thumbnail (MateDesktopThumbnailFactory *facto (strstr (uri, "/.thumbnails/") != NULL || strstr (uri, "/.cache/thumbnails/") != NULL)) return FALSE; - + if (!mime_type) return FALSE; @@ -1080,13 +1080,13 @@ mate_desktop_thumbnail_factory_can_thumbnail (MateDesktopThumbnailFactory *facto uri, mtime); } - + return FALSE; } static char * expand_thumbnailing_script (const char *script, - const int size, + const int size, const char *inuri, const char *outfile) { @@ -1096,7 +1096,7 @@ expand_thumbnailing_script (const char *script, gboolean got_in; str = g_string_new (NULL); - + got_in = FALSE; last = script; while ((p = strchr (last, '%')) != NULL) @@ -1187,7 +1187,7 @@ mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory * g_return_val_if_fail (mime_type != NULL, NULL); /* Doesn't access any volatile fields in factory, so it's threadsafe */ - + size = 128; if (factory->priv->size == MATE_DESKTOP_THUMBNAIL_SIZE_LARGE) size = 256; @@ -1205,7 +1205,7 @@ mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory * script = g_strdup (thumb->command); } g_mutex_unlock (&factory->priv->lock); - + if (script) { int fd; @@ -1246,7 +1246,7 @@ mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory * "mate-original-height")); } } - + if (pixbuf == NULL) return NULL; @@ -1259,7 +1259,7 @@ mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory * width = gdk_pixbuf_get_width (pixbuf); height = gdk_pixbuf_get_height (pixbuf); - + if (width > size || height > size) { const gchar *orig_width, *orig_height; @@ -1278,11 +1278,11 @@ mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory * if (orig_height != NULL) { gdk_pixbuf_set_option (scaled, "tEXt::Thumb::Image::Height", orig_height); } - + g_object_unref (pixbuf); pixbuf = scaled; } - + if (original_width > 0) { g_snprintf (dimension, sizeof (dimension), "%i", original_width); gdk_pixbuf_set_option (pixbuf, "tEXt::Thumb::Image::Width", dimension); @@ -1324,7 +1324,7 @@ make_thumbnail_dirs (MateDesktopThumbnailFactory *factory) g_free (thumbnail_dir); g_free (image_dir); - + return res; } @@ -1368,7 +1368,7 @@ make_thumbnail_fail_dirs (MateDesktopThumbnailFactory *factory) g_free (thumbnail_dir); g_free (fail_dir); g_free (app_dir); - + return res; } @@ -1376,9 +1376,9 @@ make_thumbnail_fail_dirs (MateDesktopThumbnailFactory *factory) /** * mate_desktop_thumbnail_factory_save_thumbnail: * @factory: a #MateDesktopThumbnailFactory - * @thumbnail: the thumbnail as a pixbuf + * @thumbnail: the thumbnail as a pixbuf * @uri: the uri of a file - * @original_mtime: the modification time of the original file + * @original_mtime: the modification time of the original file * * Saves @thumbnail at the right place. If the save fails a * failed thumbnail is written. @@ -1442,13 +1442,13 @@ mate_desktop_thumbnail_factory_save_thumbnail (MateDesktopThumbnailFactory *fact return; } close (tmp_fd); - + g_snprintf (mtime_str, 21, "%ld", original_mtime); width = gdk_pixbuf_get_option (thumbnail, "tEXt::Thumb::Image::Width"); height = gdk_pixbuf_get_option (thumbnail, "tEXt::Thumb::Image::Height"); error = NULL; - if (width != NULL && height != NULL) + if (width != NULL && height != NULL) saved_ok = gdk_pixbuf_save (thumbnail, tmp_path, "png", &error, @@ -1466,7 +1466,7 @@ mate_desktop_thumbnail_factory_save_thumbnail (MateDesktopThumbnailFactory *fact "tEXt::Thumb::MTime", mtime_str, "tEXt::Software", "MATE::ThumbnailFactory", NULL); - + if (saved_ok) { @@ -1548,12 +1548,12 @@ mate_desktop_thumbnail_factory_create_failed_thumbnail (MateDesktopThumbnailFact return; } close (tmp_fd); - + g_snprintf (mtime_str, 21, "%ld", mtime); pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, 1, 1); saved_ok = gdk_pixbuf_save (pixbuf, tmp_path, - "png", NULL, + "png", NULL, "tEXt::Thumb::URI", uri, "tEXt::Thumb::MTime", mtime_str, "tEXt::Software", "MATE::ThumbnailFactory", @@ -1611,7 +1611,7 @@ mate_desktop_thumbnail_path_for_uri (const char *uri, md5 = mate_desktop_thumbnail_md5 (uri); file = g_strconcat (md5, ".png", NULL); g_free (md5); - + path = g_build_filename (g_get_user_cache_dir (), "thumbnails", (size == MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL)?"normal":"large", @@ -1639,7 +1639,7 @@ mate_desktop_thumbnail_has_uri (GdkPixbuf *pixbuf, const char *uri) { const char *thumb_uri; - + thumb_uri = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::URI"); if (!thumb_uri) return FALSE; @@ -1667,19 +1667,19 @@ mate_desktop_thumbnail_is_valid (GdkPixbuf *pixbuf, { const char *thumb_uri, *thumb_mtime_str; time_t thumb_mtime; - + thumb_uri = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::URI"); if (!thumb_uri) return FALSE; if (strcmp (uri, thumb_uri) != 0) return FALSE; - + thumb_mtime_str = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::MTime"); if (!thumb_mtime_str) return FALSE; thumb_mtime = atol (thumb_mtime_str); if (mtime != thumb_mtime) return FALSE; - + return TRUE; } diff --git a/libmate-desktop/mate-gsettings.c b/libmate-desktop/mate-gsettings.c index c29bcde..6bb4048 100644 --- a/libmate-desktop/mate-gsettings.c +++ b/libmate-desktop/mate-gsettings.c @@ -31,7 +31,7 @@ * Check if a given schema is installed in GSettings. * * Return value: TRUE if schema exists, FALSE if not. - * + * * Since: 1.7.1 */ gboolean diff --git a/libmate-desktop/mate-hsv.c b/libmate-desktop/mate-hsv.c index 1d17342..6cb7e9a 100644 --- a/libmate-desktop/mate-hsv.c +++ b/libmate-desktop/mate-hsv.c @@ -75,14 +75,14 @@ struct _MateHSVPrivate double h; double s; double v; - + /* Size and ring width */ int size; int ring_width; - + /* Window for capturing events */ GdkWindow *window; - + /* Dragging mode */ DragMode mode; @@ -495,13 +495,13 @@ compute_sv (MateHSV *hsv, vy = center_y - ivy; x -= center_x; y = center_y - y; - + if (vx * (x - sx) + vy * (y - sy) < 0.0) { *s = 1.0; *v = (((x - sx) * (hx - sx) + (y - sy) * (hy-sy)) / ((hx - sx) * (hx - sx) + (hy - sy) * (hy - sy))); - + if (*v < 0.0) *v = 0.0; else if (*v > 1.0) @@ -512,7 +512,7 @@ compute_sv (MateHSV *hsv, *s = 0.0; *v = (((x - sx) * (vx - sx) + (y - sy) * (vy - sy)) / ((vx - sx) * (vx - sx) + (vy - sy) * (vy - sy))); - + if (*v < 0.0) *v = 0.0; else if (*v > 1.0) @@ -523,7 +523,7 @@ compute_sv (MateHSV *hsv, *v = 1.0; *s = (((x - vx) * (hx - vx) + (y - vy) * (hy - vy)) / ((hx - vx) * (hx - vx) + (hy - vy) * (hy - vy))); - + if (*s < 0.0) *s = 0.0; else if (*s > 1.0) @@ -533,7 +533,7 @@ compute_sv (MateHSV *hsv, { *v = (((x - sx) * (hy - vy) - (y - sy) * (hx - vx)) / ((vx - sx) * (hy - vy) - (vy - sy) * (hx - vx))); - + if (*v<= 0.0) { *v = 0.0; @@ -565,14 +565,14 @@ is_in_triangle (MateHSV *hsv, { int hx, hy, sx, sy, vx, vy; double det, s, v; - + compute_triangle (hsv, &hx, &hy, &sx, &sy, &vx, &vy); - + det = (vx - sx) * (hy - sy) - (vy - sy) * (hx - sx); - + s = ((x - sx) * (hy - sy) - (y - sy) * (hx - sx)) / det; v = ((vx - sx) * (y - sy) - (vy - sy) * (x - sx)) / det; - + return (s >= 0.0 && v >= 0.0 && s + v <= 1.0); } @@ -839,12 +839,12 @@ paint_ring (MateHSV *hsv, * will get properly clipped at the edges of the ring */ source_cr = cairo_create (source); - + r = priv->h; g = 1.0; b = 1.0; hsv_to_rgb (&r, &g, &b); - + if (INTENSITY (r, g, b) > 0.5) cairo_set_source_rgb (source_cr, 0., 0., 0.); else @@ -860,7 +860,7 @@ paint_ring (MateHSV *hsv, /* Draw the ring using the source image */ cairo_save (cr); - + cairo_set_source_surface (cr, source, 0, 0); cairo_surface_destroy (source); @@ -871,9 +871,9 @@ paint_ring (MateHSV *hsv, priv->size / 2. - priv->ring_width / 2., 0, 2 * G_PI); cairo_stroke (cr); - + cairo_restore (cr); - + g_free (buf); } @@ -887,7 +887,7 @@ get_color (gdouble h, gint *b) { hsv_to_rgb (&h, &s, &v); - + *r = floor (h * 255 + 0.5); *g = floor (s * 255 + 0.5); *b = floor (v * 255 + 0.5); @@ -928,12 +928,12 @@ paint_triangle (MateHSV *hsv, int width, height; GtkStyleContext *context; - width = gtk_widget_get_allocated_width (widget); - height = gtk_widget_get_allocated_height (widget); + width = gtk_widget_get_allocated_width (widget); + height = gtk_widget_get_allocated_height (widget); /* Compute triangle's vertices */ - + compute_triangle (hsv, &hx, &hy, &sx, &sy, &vx, &vy); - + x1 = hx; y1 = hy; get_color (priv->h, 1.0, 1.0, &r1, &g1, &b1); @@ -1044,25 +1044,25 @@ paint_triangle (MateHSV *hsv, source = cairo_image_surface_create_for_data ((unsigned char *)buf, CAIRO_FORMAT_RGB24, width, height, stride); - + /* Draw a triangle with the image as a source */ cairo_set_source_surface (cr, source, 0, 0); cairo_surface_destroy (source); - + cairo_move_to (cr, x1, y1); cairo_line_to (cr, x2, y2); cairo_line_to (cr, x3, y3); cairo_close_path (cr); cairo_fill (cr); - + g_free (buf); - + /* Draw value marker */ - + xx = floor (sx + (vx - sx) * priv->v + (hx - vx) * priv->s * priv->v + 0.5); yy = floor (sy + (vy - sy) * priv->v + (hy - vy) * priv->s * priv->v + 0.5); - + r = priv->h; g = priv->s; b = priv->v; @@ -1089,7 +1089,7 @@ paint_triangle (MateHSV *hsv, cairo_new_path (cr); cairo_arc (cr, xx, yy, RADIUS, 0, 2 * G_PI); cairo_stroke (cr); - + /* Draw focus outline */ if (draw_focus && !priv->focus_on_ring) @@ -1158,7 +1158,7 @@ mate_hsv_focus (GtkWidget *widget, gtk_widget_grab_focus (GTK_WIDGET (hsv)); return TRUE; } - + switch (dir) { case GTK_DIR_UP: @@ -1238,9 +1238,9 @@ mate_hsv_set_color (MateHSV *hsv, priv->h = h; priv->s = s; priv->v = v; - + g_signal_emit (hsv, hsv_signals[CHANGED], 0); - + gtk_widget_queue_draw (GTK_WIDGET (hsv)); } @@ -1303,7 +1303,7 @@ mate_hsv_set_metrics (MateHSV *hsv, priv->size = size; priv->ring_width = ring_width; - + if (same_size) gtk_widget_queue_draw (GTK_WIDGET (hsv)); else @@ -1331,18 +1331,18 @@ mate_hsv_get_metrics (MateHSV *hsv, if (size) *size = priv->size; - + if (ring_width) *ring_width = priv->ring_width; } /** * mate_hsv_is_adjusting: - * @hsv: A #MateHSV + * @hsv: A #MateHSV * * An HSV color selector can be said to be adjusting if multiple rapid - * changes are being made to its value, for example, when the user is - * adjusting the value with the mouse. This function queries whether + * changes are being made to its value, for example, when the user is + * adjusting the value with the mouse. This function queries whether * the HSV color selector is being adjusted or not. * * Returns: %TRUE if clients can ignore changes to the color value, @@ -1433,7 +1433,7 @@ mate_hsv_move (MateHSV *hsv, hue = 1.0; else if (hue > 1.0) hue = 0.0; - + mate_hsv_set_color (hsv, hue, sat, val); } diff --git a/libmate-desktop/mate-rr-config.c b/libmate-desktop/mate-rr-config.c index 09d2b8f..d281420 100644 --- a/libmate-desktop/mate-rr-config.c +++ b/libmate-desktop/mate-rr-config.c @@ -3,9 +3,9 @@ * * Copyright 2007, 2008, Red Hat, Inc. * Copyright 2010 Giovanni Campagna - * + * * This file is part of the Mate Library. - * + * * The Mate 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 @@ -15,12 +15,12 @@ * 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 Mate Library; see the file COPYING.LIB. If not, * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. - * + * * Author: Soren Sandmann */ @@ -127,11 +127,11 @@ stack_is (Parser *parser, const char *s; GList *l1, *l2; va_list args; - + stack = g_list_prepend (stack, (gpointer)s1); - + va_start (args, s1); - + s = va_arg (args, const char *); while (s) { @@ -140,10 +140,10 @@ stack_is (Parser *parser, } va_end (args); - + l1 = stack; l2 = parser->stack->head; - + while (l1 && l2) { if (strcmp (l1->data, l2->data) != 0) @@ -151,13 +151,13 @@ stack_is (Parser *parser, g_list_free (stack); return FALSE; } - + l1 = l1->next; l2 = l2->next; } - + g_list_free (stack); - + return (!l1 && !l2); } @@ -178,7 +178,7 @@ handle_start_element (GMarkupParseContext *context, parser->output = g_object_new (MATE_TYPE_RR_OUTPUT_INFO, NULL); parser->output->priv->rotation = 0; - + for (i = 0; attr_names[i] != NULL; ++i) { if (strcmp (attr_names[i], "name") == 0) @@ -194,9 +194,9 @@ handle_start_element (GMarkupParseContext *context, * something up than to crash later. */ g_warning ("Malformed monitor configuration file"); - + parser->output->priv->name = g_strdup ("default"); - } + } parser->output->priv->connected = FALSE; parser->output->priv->on = FALSE; parser->output->priv->primary = FALSE; @@ -204,7 +204,7 @@ handle_start_element (GMarkupParseContext *context, else if (strcmp (name, "configuration") == 0) { g_assert (parser->configuration == NULL); - + parser->configuration = g_object_new (MATE_TYPE_RR_CONFIG, NULL); parser->configuration->priv->clone = FALSE; parser->configuration->priv->outputs = NULL; @@ -233,13 +233,13 @@ handle_end_element (GMarkupParseContext *context, GError **err) { Parser *parser = user_data; - + if (strcmp (name, "output") == 0) { /* If no rotation properties were set, just use MATE_RR_ROTATION_0 */ if (parser->output->priv->rotation == 0) parser->output->priv->rotation = MATE_RR_ROTATION_0; - + g_ptr_array_add (parser->outputs, parser->output); parser->output = NULL; @@ -253,7 +253,7 @@ handle_end_element (GMarkupParseContext *context, g_ptr_array_add (parser->configurations, parser->configuration); parser->configuration = NULL; } - + g_free (g_queue_pop_tail (parser->stack)); } @@ -267,11 +267,11 @@ handle_text (GMarkupParseContext *context, GError **err) { Parser *parser = user_data; - + if (stack_is (parser, "vendor", "output", "configuration", TOPLEVEL_ELEMENT, NULL)) { parser->output->priv->connected = TRUE; - + strncpy ((gchar*) parser->output->priv->vendor, text, 3); parser->output->priv->vendor[3] = 0; } @@ -403,7 +403,7 @@ parser_free (Parser *parser) for (list = parser->stack->head; list; list = list->next) g_free (list->data); g_queue_free (parser->stack); - + g_free (parser); } @@ -424,21 +424,21 @@ configurations_read_from_file (const gchar *filename, GError **error) parser->configurations = g_ptr_array_new (); parser->outputs = g_ptr_array_new (); parser->stack = g_queue_new (); - + if (!parse_file_gmarkup (filename, &callbacks, parser, error)) { result = NULL; - + g_assert (parser->outputs); goto out; } g_assert (parser->outputs); - + g_ptr_array_add (parser->configurations, NULL); result = (MateRRConfig **)g_ptr_array_free (parser->configurations, FALSE); parser->configurations = g_ptr_array_new (); - + g_assert (parser->outputs); out: parser_free (parser); @@ -507,7 +507,7 @@ mate_rr_config_load_current (MateRRConfig *config, GError **error) rr_outputs = mate_rr_screen_list_outputs (config->priv->screen); config->priv->clone = FALSE; - + for (i = 0; rr_outputs[i] != NULL; ++i) { MateRROutput *rr_output = rr_outputs[i]; @@ -539,7 +539,7 @@ mate_rr_config_load_current (MateRRConfig *config, GError **error) { memcpy (output->priv->vendor, info->manufacturer_code, sizeof (output->priv->vendor)); - + output->priv->product = info->product_code; output->priv->serial = info->serial_number; output->priv->aspect = info->aspect_ratio; @@ -555,16 +555,16 @@ mate_rr_config_load_current (MateRRConfig *config, GError **error) output->priv->display_name = g_strdup (_("Laptop")); else output->priv->display_name = make_display_name (info); - + g_free (info); - + crtc = mate_rr_output_get_crtc (rr_output); mode = crtc? mate_rr_crtc_get_current_mode (crtc) : NULL; - + if (crtc && mode) { output->priv->on = TRUE; - + mate_rr_crtc_get_position (crtc, &output->priv->x, &output->priv->y); output->priv->width = mate_rr_mode_get_width (mode); output->priv->height = mate_rr_mode_get_height (mode); @@ -589,11 +589,11 @@ mate_rr_config_load_current (MateRRConfig *config, GError **error) /* Get preferred size for the monitor */ mode = mate_rr_output_get_preferred_mode (rr_output); - + if (!mode) { MateRRMode **modes = mate_rr_output_list_modes (rr_output); - + /* FIXME: we should pick the "best" mode here, where best is * sorted wrt * @@ -607,7 +607,7 @@ mate_rr_config_load_current (MateRRConfig *config, GError **error) if (modes[0]) mode = modes[0]; } - + if (mode) { output->priv->pref_width = mate_rr_mode_get_width (mode); @@ -622,12 +622,12 @@ mate_rr_config_load_current (MateRRConfig *config, GError **error) } output->priv->primary = mate_rr_output_get_is_primary (rr_output); - + g_ptr_array_add (a, output); } g_ptr_array_add (a, NULL); - + config->priv->outputs = (MateRROutputInfo **)g_ptr_array_free (a, FALSE); /* Walk the outputs computing the right-most edge of all @@ -657,7 +657,7 @@ mate_rr_config_load_current (MateRRConfig *config, GError **error) last_x = output->priv->x + output->priv->width; } } - + g_assert (mate_rr_config_match (config, config)); return TRUE; @@ -782,7 +782,7 @@ parse_file_gmarkup (const gchar *filename, result = FALSE; goto out; } - + context = g_markup_parse_context_new (parser, 0, data, NULL); if (!g_markup_parse_context_parse (context, contents, len, err)) @@ -827,7 +827,7 @@ output_match (MateRROutputInfo *output1, MateRROutputInfo *output2) if (output1->priv->connected != output2->priv->connected) return FALSE; - + return TRUE; } @@ -847,19 +847,19 @@ output_equal (MateRROutputInfo *output1, MateRROutputInfo *output2) { if (output1->priv->width != output2->priv->width) return FALSE; - + if (output1->priv->height != output2->priv->height) return FALSE; - + if (output1->priv->rate != output2->priv->rate) return FALSE; - + if (output1->priv->x != output2->priv->x) return FALSE; - + if (output1->priv->y != output2->priv->y) return FALSE; - + if (output1->priv->rotation != output2->priv->rotation) return FALSE; } @@ -875,7 +875,7 @@ find_output (MateRRConfig *config, const char *name) for (i = 0; config->priv->outputs[i] != NULL; ++i) { MateRROutputInfo *output = config->priv->outputs[i]; - + if (strcmp (name, output->priv->name) == 0) return output; } @@ -902,7 +902,7 @@ mate_rr_config_match (MateRRConfig *c1, MateRRConfig *c2) if (!output2 || !output_match (output1, output2)) return FALSE; } - + return TRUE; } @@ -926,7 +926,7 @@ mate_rr_config_equal (MateRRConfig *c1, if (!output2 || !output_equal (output1, output2)) return FALSE; } - + return TRUE; } @@ -940,7 +940,7 @@ make_outputs (MateRRConfig *config) outputs = g_ptr_array_new (); first_on = NULL; - + for (i = 0; config->priv->outputs[i] != NULL; ++i) { MateRROutputInfo *old = config->priv->outputs[i]; @@ -953,7 +953,7 @@ make_outputs (MateRRConfig *config) if (old->priv->on && !first_on) first_on = old; - + if (config->priv->clone && new->priv->on) { g_assert (first_on); @@ -1071,14 +1071,14 @@ emit_configuration (MateRRConfig *config, g_string_append_printf (string, " \n"); g_string_append_printf (string, " %s\n", yes_no (config->priv->clone)); - + for (j = 0; config->priv->outputs[j] != NULL; ++j) { MateRROutputInfo *output = config->priv->outputs[j]; - + g_string_append_printf ( string, " \n", output->priv->name); - + if (output->priv->connected && *output->priv->vendor != '\0') { g_string_append_printf ( @@ -1088,7 +1088,7 @@ emit_configuration (MateRRConfig *config, g_string_append_printf ( string, " 0x%08x\n", output->priv->serial); } - + /* An unconnected output which is on does not make sense */ if (output->priv->connected && output->priv->on) { @@ -1111,10 +1111,10 @@ emit_configuration (MateRRConfig *config, g_string_append_printf ( string, " %s\n", yes_no (output->priv->primary)); } - + g_string_append_printf (string, " \n"); } - + g_string_append_printf (string, " \n"); } @@ -1143,7 +1143,7 @@ mate_rr_config_sanitize (MateRRConfig *config) for (i = 0; config->priv->outputs[i]; ++i) { MateRROutputInfo *output = config->priv->outputs[i]; - + if (output->priv->on) { output->priv->x -= x_offset; @@ -1244,7 +1244,7 @@ mate_rr_config_save (MateRRConfig *configuration, GError **error) intended_filename = mate_rr_config_get_intended_filename (); configurations = configurations_read_from_file (intended_filename, NULL); /* NULL-GError */ - + g_string_append_printf (output, "\n"); if (configurations) @@ -1300,7 +1300,7 @@ mate_rr_config_apply_with_time (MateRRConfig *config, for (i = 0; outputs[i] != NULL; i++) g_object_unref (outputs[i]); g_free (outputs); - + if (assignment) { if (crtc_assignment_apply (assignment, timestamp, error)) @@ -1377,7 +1377,7 @@ mate_rr_config_apply_from_filename_with_time (MateRRScreen *screen, const char * result = mate_rr_config_apply_with_time (stored, screen, timestamp, error); g_object_unref (stored); - + return result; } else @@ -1545,19 +1545,19 @@ crtc_assignment_assign (CrtcAssignment *assign, return TRUE; } else - { + { CrtcInfo *info = g_new0 (CrtcInfo, 1); - + info->mode = mode; info->x = x; info->y = y; info->rotation = rotation; info->outputs = g_ptr_array_new (); - + g_ptr_array_add (info->outputs, output); - + g_hash_table_insert (assign->info, crtc, info); - + if (primary && !assign->primary) { assign->primary = output; @@ -1801,7 +1801,7 @@ get_required_virtual_size (CrtcAssignment *assign, int *width, int *height) width = &d; if (!height) height = &d; - + /* Compute size of the screen */ *width = *height = 1; for (list = active_crtcs; list != NULL; list = list->next) @@ -1812,14 +1812,14 @@ get_required_virtual_size (CrtcAssignment *assign, int *width, int *height) w = mate_rr_mode_get_width (info->mode); h = mate_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); } @@ -1865,13 +1865,13 @@ crtc_assignment_new (MateRRScreen *screen, MateRROutputInfo **outputs, GError ** } assignment->screen = screen; - + return assignment; } fail: crtc_assignment_free (assignment); - + return NULL; } @@ -1931,7 +1931,7 @@ crtc_assignment_apply (CrtcAssignment *assign, guint32 timestamp, GError **error h = w; w = tmp; } - + if (x + w > width || y + h > height || !g_hash_table_lookup (assign->info, crtc)) { if (!mate_rr_crtc_set_config_with_time (crtc, timestamp, 0, 0, NULL, MATE_RR_ROTATION_0, NULL, 0, error)) @@ -1939,7 +1939,7 @@ crtc_assignment_apply (CrtcAssignment *assign, guint32 timestamp, GError **error success = FALSE; break; } - + } } } @@ -1962,7 +1962,7 @@ crtc_assignment_apply (CrtcAssignment *assign, guint32 timestamp, GError **error state.timestamp = timestamp; state.has_error = FALSE; state.error = error; - + g_hash_table_foreach (assign->info, configure_crtc, &state); success = !state.has_error; diff --git a/libmate-desktop/mate-rr-config.h b/libmate-desktop/mate-rr-config.h index 85c8c9f..0321035 100644 --- a/libmate-desktop/mate-rr-config.h +++ b/libmate-desktop/mate-rr-config.h @@ -3,9 +3,9 @@ * * Copyright 2007, 2008, Red Hat, Inc. * Copyright 2010 Giovanni Campagna - * + * * This file is part of the Mate Library. - * + * * The Mate 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 @@ -15,12 +15,12 @@ * 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 Mate Library; see the file COPYING.LIB. If not, * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. - * + * * Author: Soren Sandmann */ #ifndef MATE_RR_CONFIG_H diff --git a/libmate-desktop/mate-rr-private.h b/libmate-desktop/mate-rr-private.h index d5410ca..553c91a 100644 --- a/libmate-desktop/mate-rr-private.h +++ b/libmate-desktop/mate-rr-private.h @@ -19,11 +19,11 @@ struct ScreenInfo #ifdef HAVE_RANDR XRRScreenResources *resources; #endif - + MateRROutput ** outputs; MateRRCrtc ** crtcs; MateRRMode ** modes; - + MateRRScreen * screen; MateRRMode ** clone_modes; @@ -41,11 +41,11 @@ struct MateRRScreenPrivate Screen * xscreen; Window xroot; ScreenInfo * info; - + int randr_event_base; int rr_major_version; int rr_minor_version; - + Atom connector_type_atom; }; diff --git a/libmate-desktop/mate-rr.c b/libmate-desktop/mate-rr.c index 04ffd0d..97859a1 100644 --- a/libmate-desktop/mate-rr.c +++ b/libmate-desktop/mate-rr.c @@ -1,9 +1,9 @@ /* mate-rr.c * * Copyright 2007, 2008, Red Hat, Inc. - * + * * This file is part of the Mate Library. - * + * * The Mate 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 @@ -13,12 +13,12 @@ * 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 Mate Library; see the file COPYING.LIB. If not, * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. - * + * * Author: Soren Sandmann */ @@ -77,7 +77,7 @@ struct MateRROutput { ScreenInfo * info; RROutput id; - + char * name; MateRRCrtc * current_crtc; gboolean connected; @@ -101,13 +101,13 @@ struct MateRRCrtc { ScreenInfo * info; RRCrtc id; - + MateRRMode * current_mode; MateRROutput ** current_outputs; MateRROutput ** possible_outputs; int x; int y; - + MateRRRotation current_rotation; MateRRRotation rotations; int gamma_size; @@ -195,15 +195,15 @@ static MateRROutput * mate_rr_output_by_id (ScreenInfo *info, RROutput id) { MateRROutput **output; - + g_assert (info != NULL); - + for (output = info->outputs; *output; ++output) { if ((*output)->id == id) return *output; } - + return NULL; } @@ -211,16 +211,16 @@ static MateRRCrtc * crtc_by_id (ScreenInfo *info, RRCrtc id) { MateRRCrtc **crtc; - + if (!info) return NULL; - + for (crtc = info->crtcs; *crtc; ++crtc) { if ((*crtc)->id == id) return *crtc; } - + return NULL; } @@ -228,15 +228,15 @@ static MateRRMode * mode_by_id (ScreenInfo *info, RRMode id) { MateRRMode **mode; - + g_assert (info != NULL); - + for (mode = info->modes; *mode; ++mode) { if ((*mode)->id == id) return *mode; } - + return NULL; } @@ -246,32 +246,32 @@ screen_info_free (ScreenInfo *info) MateRROutput **output; MateRRCrtc **crtc; MateRRMode **mode; - + g_assert (info != NULL); #ifdef HAVE_RANDR if (info->resources) { XRRFreeScreenResources (info->resources); - + info->resources = NULL; } #endif - + if (info->outputs) { for (output = info->outputs; *output; ++output) output_free (*output); g_free (info->outputs); } - + if (info->crtcs) { for (crtc = info->crtcs; *crtc; ++crtc) crtc_free (*crtc); g_free (info->crtcs); } - + if (info->modes) { for (mode = info->modes; *mode; ++mode) @@ -284,7 +284,7 @@ screen_info_free (ScreenInfo *info) /* The modes themselves were freed above */ g_free (info->clone_modes); } - + g_free (info); } @@ -322,10 +322,10 @@ gather_clone_modes (ScreenInfo *info) MateRROutput *output1, *output2; output1 = info->outputs[i]; - + if (!output1->connected) continue; - + for (j = 0; output1->modes[j] != NULL; ++j) { MateRRMode *mode = output1->modes[j]; @@ -336,10 +336,10 @@ gather_clone_modes (ScreenInfo *info) for (k = 0; info->outputs[k] != NULL; ++k) { output2 = info->outputs[k]; - + if (!output2->connected) continue; - + if (!has_similar_mode (output2, mode)) { valid = FALSE; @@ -353,7 +353,7 @@ gather_clone_modes (ScreenInfo *info) } g_ptr_array_add (result, NULL); - + info->clone_modes = (MateRRMode **)g_ptr_array_free (result, FALSE); } @@ -439,7 +439,7 @@ fill_out_screen_info (Display *xdisplay, #ifdef HAVE_RANDR XRRScreenResources *resources; GdkDisplay *display; - + g_assert (xdisplay != NULL); g_assert (info != NULL); @@ -492,7 +492,7 @@ fill_out_screen_info (Display *xdisplay, } else { - mate_rr_screen_get_ranges (info->screen, + mate_rr_screen_get_ranges (info->screen, &(info->min_width), &(info->max_width), &(info->min_height), @@ -525,7 +525,7 @@ screen_info_new (MateRRScreen *screen, gboolean needs_reprobe, GError **error) info->crtcs = NULL; info->modes = NULL; info->screen = screen; - + if (fill_out_screen_info (priv->xdisplay, priv->xroot, info, needs_reprobe, error)) { return info; @@ -542,7 +542,7 @@ screen_update (MateRRScreen *screen, gboolean force_callback, gboolean needs_rep { ScreenInfo *info; gboolean changed = FALSE; - + g_assert (screen != NULL); info = screen_info_new (screen, needs_reprobe, error); @@ -555,12 +555,12 @@ screen_update (MateRRScreen *screen, gboolean force_callback, gboolean needs_rep #endif screen_info_free (screen->priv->info); - + screen->priv->info = info; if (changed || force_callback) g_signal_emit (G_OBJECT (screen), screen_signals[SCREEN_CHANGED], 0); - + return changed; } @@ -878,16 +878,16 @@ mate_rr_screen_get_ranges (MateRRScreen *screen, g_return_if_fail (MATE_IS_RR_SCREEN (screen)); priv = screen->priv; - + if (min_width) *min_width = priv->info->min_width; - + if (max_width) *max_width = priv->info->max_width; - + if (min_height) *min_height = priv->info->min_height; - + if (max_height) *max_height = priv->info->max_height; } @@ -1020,7 +1020,7 @@ mate_rr_screen_list_modes (MateRRScreen *screen) { g_return_val_if_fail (MATE_IS_RR_SCREEN (screen), NULL); g_return_val_if_fail (screen->priv->info != NULL, NULL); - + return screen->priv->info->modes; } @@ -1052,7 +1052,7 @@ mate_rr_screen_list_crtcs (MateRRScreen *screen) { g_return_val_if_fail (MATE_IS_RR_SCREEN (screen), NULL); g_return_val_if_fail (screen->priv->info != NULL, NULL); - + return screen->priv->info->crtcs; } @@ -1068,7 +1068,7 @@ mate_rr_screen_list_outputs (MateRRScreen *screen) { g_return_val_if_fail (MATE_IS_RR_SCREEN (screen), NULL); g_return_val_if_fail (screen->priv->info != NULL, NULL); - + return screen->priv->info->outputs; } @@ -1083,18 +1083,18 @@ mate_rr_screen_get_crtc_by_id (MateRRScreen *screen, { MateRRCrtc **crtcs; int i; - + g_return_val_if_fail (MATE_IS_RR_SCREEN (screen), NULL); g_return_val_if_fail (screen->priv->info != NULL, NULL); crtcs = screen->priv->info->crtcs; - + for (i = 0; crtcs[i] != NULL; ++i) { if (crtcs[i]->id == id) return crtcs[i]; } - + return NULL; } @@ -1109,7 +1109,7 @@ mate_rr_screen_get_output_by_id (MateRRScreen *screen, { MateRROutput **outputs; int i; - + g_return_val_if_fail (MATE_IS_RR_SCREEN (screen), NULL); g_return_val_if_fail (screen->priv->info != NULL, NULL); @@ -1120,7 +1120,7 @@ mate_rr_screen_get_output_by_id (MateRRScreen *screen, if (outputs[i]->id == id) return outputs[i]; } - + return NULL; } @@ -1129,10 +1129,10 @@ static MateRROutput * output_new (ScreenInfo *info, RROutput id) { MateRROutput *output = g_slice_new0 (MateRROutput); - + output->id = id; output->info = info; - + return output; } @@ -1148,13 +1148,13 @@ get_property (Display *dpy, unsigned long nitems, bytes_after; Atom actual_type; guint8 *result; - + XRRGetOutputProperty (dpy, output, atom, 0, 100, False, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, &prop); - + if (actual_type == XA_INTEGER && actual_format == 8) { result = g_memdup (prop, nitems); @@ -1165,9 +1165,9 @@ get_property (Display *dpy, { result = NULL; } - + XFree (prop); - + return result; #else return NULL; @@ -1198,7 +1198,7 @@ read_edid_data (MateRROutput *output, int *len) else g_free (result); } - + return NULL; } @@ -1252,11 +1252,11 @@ output_initialize (MateRROutput *output, XRRScreenResources *res, GError **error DISPLAY (output), res, output->id); GPtrArray *a; int i; - + #if 0 g_print ("Output %lx Timestamp: %u\n", output->id, (guint32)info->timestamp); #endif - + if (!info || !output->info) { /* FIXME: see the comment in crtc_initialize() */ @@ -1266,7 +1266,7 @@ output_initialize (MateRROutput *output, XRRScreenResources *res, GError **error (int) output->id); return FALSE; } - + output->name = g_strdup (info->name); /* FIXME: what is nameLen used for? */ output->current_crtc = crtc_by_id (output->info, info->crtc); output->width_mm = info->mm_width; @@ -1276,46 +1276,46 @@ output_initialize (MateRROutput *output, XRRScreenResources *res, GError **error /* Possible crtcs */ a = g_ptr_array_new (); - + for (i = 0; i < info->ncrtc; ++i) { MateRRCrtc *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 = (MateRRCrtc **)g_ptr_array_free (a, FALSE); - + /* Clones */ a = g_ptr_array_new (); for (i = 0; i < info->nclone; ++i) { MateRROutput *mate_rr_output = mate_rr_output_by_id (output->info, info->clones[i]); - + if (mate_rr_output) g_ptr_array_add (a, mate_rr_output); } g_ptr_array_add (a, NULL); output->clones = (MateRROutput **)g_ptr_array_free (a, FALSE); - + /* Modes */ a = g_ptr_array_new (); for (i = 0; i < info->nmode; ++i) { MateRRMode *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 = (MateRRMode **)g_ptr_array_free (a, FALSE); - + output->n_preferred = info->npreferred; - + /* Edid data */ output->edid_data = read_edid_data (output, &output->edid_size); - + XRRFreeOutputInfo (info); return TRUE; @@ -1384,7 +1384,7 @@ guint32 mate_rr_output_get_id (MateRROutput *output) { g_assert(output != NULL); - + return output->id; } @@ -1392,7 +1392,7 @@ const guint8 * mate_rr_output_get_edid_data (MateRROutput *output) { g_return_val_if_fail (output != NULL, NULL); - + return output->edid_data; } @@ -1406,18 +1406,18 @@ mate_rr_screen_get_output_by_name (MateRRScreen *screen, const char *name) { int i; - + g_return_val_if_fail (MATE_IS_RR_SCREEN (screen), NULL); g_return_val_if_fail (screen->priv->info != NULL, NULL); - + for (i = 0; screen->priv->info->outputs[i] != NULL; ++i) { MateRROutput *output = screen->priv->info->outputs[i]; - + if (strcmp (output->name, name) == 0) return output; } - + return NULL; } @@ -1430,7 +1430,7 @@ MateRRCrtc * mate_rr_output_get_crtc (MateRROutput *output) { g_return_val_if_fail (output != NULL, NULL); - + return output->current_crtc; } @@ -1496,12 +1496,12 @@ MateRRMode * mate_rr_output_get_current_mode (MateRROutput *output) { MateRRCrtc *crtc; - + g_return_val_if_fail (output != NULL, NULL); - + if ((crtc = mate_rr_output_get_crtc (output))) return mate_rr_crtc_get_current_mode (crtc); - + return NULL; } @@ -1517,9 +1517,9 @@ mate_rr_output_get_position (MateRROutput *output, int *y) { MateRRCrtc *crtc; - + g_return_if_fail (output != NULL); - + if ((crtc = mate_rr_output_get_crtc (output))) mate_rr_crtc_get_position (crtc, x, y); } @@ -1556,7 +1556,7 @@ mate_rr_output_get_preferred_mode (MateRROutput *output) g_return_val_if_fail (output != NULL, NULL); if (output->n_preferred) return output->modes[0]; - + return NULL; } @@ -1585,16 +1585,16 @@ mate_rr_output_supports_mode (MateRROutput *output, MateRRMode *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; } @@ -1603,16 +1603,16 @@ mate_rr_output_can_clone (MateRROutput *output, MateRROutput *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; } @@ -1670,13 +1670,13 @@ mate_rr_rotation_from_xrotation (Rotation r) { int i; MateRRRotation 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; } @@ -1685,13 +1685,13 @@ xrotation_from_rotation (MateRRRotation 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; } @@ -1728,13 +1728,13 @@ mate_rr_crtc_set_config_with_time (MateRRCrtc *crtc, Status status; gboolean result; int i; - + g_return_val_if_fail (crtc != NULL, FALSE); g_return_val_if_fail (mode != NULL || outputs == NULL || n_outputs == 0, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - + info = crtc->info; - + if (mode) { if (x + mode->width > info->max_width @@ -1753,9 +1753,9 @@ mate_rr_crtc_set_config_with_time (MateRRCrtc *crtc, return FALSE; } } - + output_ids = g_array_new (FALSE, FALSE, sizeof (RROutput)); - + if (outputs) { for (i = 0; i < n_outputs; ++i) @@ -1765,13 +1765,13 @@ mate_rr_crtc_set_config_with_time (MateRRCrtc *crtc, display = gdk_display_get_default (); gdk_x11_display_error_trap_push (display); status = XRRSetCrtcConfig (DISPLAY (crtc), info->resources, crtc->id, - timestamp, + timestamp, x, y, mode ? mode->id : None, xrotation_from_rotation (rotation), (RROutput *)output_ids->data, output_ids->len); - + g_array_free (output_ids, TRUE); if (gdk_x11_display_error_trap_pop (display) || status != RRSetConfigSuccess) { @@ -1785,7 +1785,7 @@ mate_rr_crtc_set_config_with_time (MateRRCrtc *crtc, } else { result = TRUE; } - + return result; #else return FALSE; @@ -1801,7 +1801,7 @@ MateRRMode * mate_rr_crtc_get_current_mode (MateRRCrtc *crtc) { g_return_val_if_fail (crtc != NULL, NULL); - + return crtc->current_mode; } @@ -1809,7 +1809,7 @@ guint32 mate_rr_crtc_get_id (MateRRCrtc *crtc) { g_return_val_if_fail (crtc != NULL, 0); - + return crtc->id; } @@ -1818,16 +1818,16 @@ mate_rr_crtc_can_drive_output (MateRRCrtc *crtc, MateRROutput *output) { int i; - + g_return_val_if_fail (crtc != NULL, FALSE); g_return_val_if_fail (output != NULL, FALSE); - + for (i = 0; crtc->possible_outputs[i] != NULL; ++i) { if (crtc->possible_outputs[i] == output) return TRUE; } - + return FALSE; } @@ -1845,10 +1845,10 @@ mate_rr_crtc_get_position (MateRRCrtc *crtc, int *y) { g_return_if_fail (crtc != NULL); - + if (x) *x = crtc->x; - + if (y) *y = crtc->y; } @@ -1880,10 +1880,10 @@ static MateRRCrtc * crtc_new (ScreenInfo *info, RROutput id) { MateRRCrtc *crtc = g_slice_new0 (MateRRCrtc); - + crtc->id = id; crtc->info = info; - + return crtc; } @@ -1929,11 +1929,11 @@ crtc_initialize (MateRRCrtc *crtc, XRRCrtcInfo *info = XRRGetCrtcInfo (DISPLAY (crtc), res, crtc->id); GPtrArray *a; int i; - + #if 0 g_print ("CRTC %lx Timestamp: %u\n", crtc->id, (guint32)info->timestamp); #endif - + if (!info) { /* FIXME: We need to reaquire the screen resources */ @@ -1947,41 +1947,41 @@ crtc_initialize (MateRRCrtc *crtc, (int) crtc->id); return FALSE; } - + /* MateRRMode */ crtc->current_mode = mode_by_id (crtc->info, info->mode); - + crtc->x = info->x; crtc->y = info->y; - + /* Current outputs */ a = g_ptr_array_new (); for (i = 0; i < info->noutput; ++i) { MateRROutput *output = mate_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 = (MateRROutput **)g_ptr_array_free (a, FALSE); - + /* Possible outputs */ a = g_ptr_array_new (); for (i = 0; i < info->npossible; ++i) { MateRROutput *output = mate_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 = (MateRROutput **)g_ptr_array_free (a, FALSE); - + /* Rotations */ crtc->current_rotation = mate_rr_rotation_from_xrotation (info->rotation); crtc->rotations = mate_rr_rotation_from_xrotation (info->rotations); - + XRRFreeCrtcInfo (info); /* get an store gamma size */ @@ -2004,10 +2004,10 @@ static MateRRMode * mode_new (ScreenInfo *info, RRMode id) { MateRRMode *mode = g_slice_new0 (MateRRMode); - + mode->id = id; mode->info = info; - + return mode; } @@ -2045,7 +2045,7 @@ mode_initialize (MateRRMode *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; diff --git a/libmate-desktop/mate-rr.h b/libmate-desktop/mate-rr.h index cc7e427..a1a541d 100644 --- a/libmate-desktop/mate-rr.h +++ b/libmate-desktop/mate-rr.h @@ -1,9 +1,9 @@ /* mate-rr.h * * Copyright 2007, 2008, Red Hat, Inc. - * + * * This file is part of the Mate Library. - * + * * The Mate 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 @@ -13,12 +13,12 @@ * 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 Mate Library; see the file COPYING.LIB. If not, * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. - * + * * Author: Soren Sandmann */ #ifndef MATE_RR_H diff --git a/libmate-desktop/mate-thumbnail-pixbuf-utils.c b/libmate-desktop/mate-thumbnail-pixbuf-utils.c index 0252c2d..17f2280 100644 --- a/libmate-desktop/mate-thumbnail-pixbuf-utils.c +++ b/libmate-desktop/mate-thumbnail-pixbuf-utils.c @@ -45,7 +45,7 @@ * large amounts. * * Return value: (transfer full): a scaled pixbuf - * + * * Since: 2.2 **/ GdkPixbuf * @@ -70,7 +70,7 @@ mate_desktop_thumbnail_scale_down_pixbuf (GdkPixbuf *pixbuf, if (dest_width == 0 || dest_height == 0) { return NULL; } - + source_width = gdk_pixbuf_get_width (pixbuf); source_height = gdk_pixbuf_get_height (pixbuf); @@ -80,7 +80,7 @@ mate_desktop_thumbnail_scale_down_pixbuf (GdkPixbuf *pixbuf, ddx = div (source_width, dest_width); dx = ddx.quot; dx_frac = ddx.rem; - + ddy = div (source_height, dest_height); dy = ddy.quot; dy_frac = ddy.rem; @@ -95,7 +95,7 @@ mate_desktop_thumbnail_scale_down_pixbuf (GdkPixbuf *pixbuf, dest_rowstride = gdk_pixbuf_get_rowstride (dest_pixbuf); pixel_stride = (has_alpha)?4:3; - + s_y1 = 0; s_yfrac = -dest_height/2; while (s_y1 < source_height) { @@ -126,7 +126,7 @@ mate_desktop_thumbnail_scale_down_pixbuf (GdkPixbuf *pixbuf, if (has_alpha) { for (x = 0; x < s_x2-s_x1; x++) { n_pixels++; - + r += xsrc[3] * xsrc[0]; g += xsrc[3] * xsrc[1]; b += xsrc[3] * xsrc[2]; @@ -143,7 +143,7 @@ mate_desktop_thumbnail_scale_down_pixbuf (GdkPixbuf *pixbuf, } src += source_rowstride; } - + if (has_alpha) { if (a != 0) { *dest++ = r / a; @@ -167,12 +167,12 @@ mate_desktop_thumbnail_scale_down_pixbuf (GdkPixbuf *pixbuf, *dest++ = 0; } } - + s_x1 = s_x2; } s_y1 = s_y2; dest += dest_rowstride - dest_width * pixel_stride; } - + return dest_pixbuf; } diff --git a/libmate-desktop/test.c b/libmate-desktop/test.c index 42daa9d..c0fa703 100644 --- a/libmate-desktop/test.c +++ b/libmate-desktop/test.c @@ -2,7 +2,7 @@ * test.c: general tests for libmate-desktop * * Copyright (C) 2013-2014 Stefano Karapetsas - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or diff --git a/tools/mate-color-select.c b/tools/mate-color-select.c index 3821eff..5edb42e 100644 --- a/tools/mate-color-select.c +++ b/tools/mate-color-select.c @@ -2,7 +2,7 @@ * mate-color.c: MATE color selection tool * * Copyright (C) 2014 Stefano Karapetsas - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or -- cgit v1.2.1