[gnome-settings-daemon] media-keys: Remove home-made speaker rendering from OSD



commit ff8acc62eab2247436e3c349ef5483c19c93b195
Author: Bastien Nocera <hadess hadess net>
Date:   Sat Jan 12 20:41:46 2013 +0100

    media-keys: Remove home-made speaker rendering from OSD
    
    We really want to use the symbolic icons for this too.

 plugins/media-keys/gsd-osd-window.c |  150 +----------------------------------
 1 files changed, 1 insertions(+), 149 deletions(-)
---
diff --git a/plugins/media-keys/gsd-osd-window.c b/plugins/media-keys/gsd-osd-window.c
index 247240f..6507a06 100644
--- a/plugins/media-keys/gsd-osd-window.c
+++ b/plugins/media-keys/gsd-osd-window.c
@@ -335,107 +335,6 @@ load_pixbuf (GsdOsdDrawContext *ctx,
         return pixbuf;
 }
 
-static void
-draw_waves (cairo_t *cr,
-            double   cx,
-            double   cy,
-            double   max_radius,
-            int      volume_level)
-{
-        const int n_waves = 3;
-        int last_wave;
-        int i;
-
-        last_wave = n_waves * volume_level / 100;
-
-        for (i = 0; i < n_waves; i++) {
-                double angle1;
-                double angle2;
-                double radius;
-                double alpha;
-
-                angle1 = -M_PI / 4;
-                angle2 = M_PI / 4;
-
-                if (i < last_wave)
-                        alpha = 1.0;
-                else if (i > last_wave)
-                        alpha = 0.1;
-                else alpha = 0.1 + 0.9 * (n_waves * volume_level % 100) / 100.0;
-
-                radius = (i + 1) * (max_radius / n_waves);
-                cairo_arc (cr, cx, cy, radius, angle1, angle2);
-                cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, alpha / 2);
-                cairo_set_line_width (cr, 14);
-                cairo_set_line_cap  (cr, CAIRO_LINE_CAP_ROUND);
-                cairo_stroke_preserve (cr);
-
-                cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, alpha);
-                cairo_set_line_width (cr, 10);
-                cairo_set_line_cap  (cr, CAIRO_LINE_CAP_ROUND);
-                cairo_stroke (cr);
-        }
-}
-
-static void
-draw_cross (cairo_t *cr,
-            double   cx,
-            double   cy,
-            double   size)
-{
-        cairo_move_to (cr, cx, cy - size/2.0);
-        cairo_rel_line_to (cr, size, size);
-
-        cairo_move_to (cr, cx, cy + size/2.0);
-        cairo_rel_line_to (cr, size, -size);
-
-        cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, FG_ALPHA / 2);
-        cairo_set_line_width (cr, 14);
-        cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
-        cairo_stroke_preserve (cr);
-
-        cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, FG_ALPHA);
-        cairo_set_line_width (cr, 10);
-        cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
-        cairo_stroke (cr);
-}
-
-static void
-draw_speaker (cairo_t *cr,
-              double   cx,
-              double   cy,
-              double   width,
-              double   height)
-{
-        double box_width;
-        double box_height;
-        double _x0;
-        double _y0;
-
-        box_width = width / 3;
-        box_height = height / 3;
-
-        _x0 = cx - (width / 2) + box_width;
-        _y0 = cy - box_height / 2;
-
-        cairo_move_to (cr, _x0, _y0);
-        cairo_rel_line_to (cr, - box_width, 0);
-        cairo_rel_line_to (cr, 0, box_height);
-        cairo_rel_line_to (cr, box_width, 0);
-
-        cairo_line_to (cr, cx + box_width, cy + height / 2);
-        cairo_rel_line_to (cr, 0, -height);
-        cairo_line_to (cr, _x0, _y0);
-        cairo_close_path (cr);
-
-        cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, FG_ALPHA);
-        cairo_fill_preserve (cr);
-
-        cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, FG_ALPHA / 2);
-        cairo_set_line_width (cr, 2);
-        cairo_stroke (cr);
-}
-
 static gboolean
 render_speaker (GsdOsdDrawContext *ctx,
                 cairo_t           *cr,
@@ -580,7 +479,6 @@ static void
 draw_action_volume (GsdOsdDrawContext *ctx,
                     cairo_t           *cr)
 {
-        gboolean res;
         GdkRectangle icon_box, label_box, volume_box;
 
         get_bounding_boxes (ctx, &icon_box, &label_box, &volume_box);
@@ -598,53 +496,7 @@ draw_action_volume (GsdOsdDrawContext *ctx,
                    volume_box.y);
 #endif
 
-        res = render_speaker (ctx, cr, &icon_box);
-        if (! res) {
-                double speaker_width;
-                double speaker_height;
-                double speaker_cx;
-                double speaker_cy;
-
-                speaker_width = icon_box.width * 0.5;
-                speaker_height = icon_box.height * 0.75;
-                speaker_cx = icon_box.x + speaker_width / 2;
-                speaker_cy = icon_box.y + speaker_height / 2;
-
-#if 0
-                g_message ("speaker box: w=%d h=%d cx=%d cy=%d",
-                           speaker_width,
-                           speaker_height,
-                           speaker_cx,
-                           speaker_cy);
-#endif
-
-                /* draw speaker symbol */
-                draw_speaker (cr, speaker_cx, speaker_cy, speaker_width, speaker_height);
-
-                if (!ctx->volume_muted) {
-                        /* draw sound waves */
-                        double wave_x0;
-                        double wave_y0;
-                        double wave_radius;
-
-                        wave_x0 = ctx->size / 2;
-                        wave_y0 = speaker_cy;
-                        wave_radius = icon_box.width / 2;
-
-                        draw_waves (cr, wave_x0, wave_y0, wave_radius, ctx->volume_level);
-                } else {
-                        /* draw 'mute' cross */
-                        double cross_x0;
-                        double cross_y0;
-                        double cross_size;
-
-                        cross_size = speaker_width * 3 / 4;
-                        cross_x0 = icon_box.x + icon_box.width - cross_size;
-                        cross_y0 = speaker_cy;
-
-                        draw_cross (cr, cross_x0, cross_y0, cross_size);
-                }
-        }
+        render_speaker (ctx, cr, &icon_box);
 
         /* draw volume label */
         draw_volume_label (ctx, cr, &label_box);



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