static void draw_action_volume (GsdMediaKeysWindow *window, cairo_t *cr) { int window_width; int window_height; double icon_box_width; double icon_box_height; double icon_box_x0; double icon_box_y0; double volume_box_x0; double volume_box_y0; double volume_box_width; double volume_box_height; gboolean res; gtk_window_get_size (GTK_WINDOW (window), &window_width, &window_height); icon_box_width = round (window_width * ICON_SCALE); icon_box_height = round (window_height * ICON_SCALE); volume_box_width = icon_box_width; volume_box_height = round (window_height * 0.05); icon_box_x0 = round ((window_width - icon_box_width) / 2); icon_box_y0 = round ((window_height - icon_box_height - volume_box_height) / 2 - volume_box_height); volume_box_x0 = round (icon_box_x0); volume_box_y0 = round (icon_box_height + icon_box_y0) + volume_box_height; #if 0 g_message ("icon box: w=%f h=%f _x0=%f _y0=%f", icon_box_width, icon_box_height, icon_box_x0, icon_box_y0); g_message ("volume box: w=%f h=%f _x0=%f _y0=%f", volume_box_width, volume_box_height, volume_box_x0, volume_box_y0); #endif res = render_speaker (window, cr, icon_box_x0, icon_box_y0, icon_box_width, icon_box_height); 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_x0 + speaker_width / 2; speaker_cy = icon_box_y0 + speaker_height / 2; #if 0 g_message ("speaker box: w=%f h=%f cx=%f cy=%f", speaker_width, speaker_height, speaker_cx, speaker_cy); #endif /* draw speaker symbol */ draw_speaker (cr, speaker_cx, speaker_cy, speaker_width, speaker_height); if (! window->priv->volume_muted) { /* draw sound waves */ double wave_x0; double wave_y0; double wave_radius; wave_x0 = window_width / 2; wave_y0 = speaker_cy; wave_radius = icon_box_width / 2; draw_waves (cr, wave_x0, wave_y0, wave_radius, window->priv->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_x0 + icon_box_width - cross_size; cross_y0 = speaker_cy; draw_cross (cr, cross_x0, cross_y0, cross_size); } } /* draw volume meter */ draw_volume_boxes (window, cr, (double)window->priv->volume_level / 100.0, volume_box_x0, volume_box_y0, volume_box_width, volume_box_height); }
static void draw_action_custom (GsdMediaKeysWindow *window, cairo_t *cr) { int window_width; int window_height; double icon_box_width; double icon_box_height; double icon_box_x0; double icon_box_y0; double bright_box_x0; double bright_box_y0; double bright_box_width; double bright_box_height; gboolean res; gtk_window_get_size (GTK_WINDOW (window), &window_width, &window_height); icon_box_width = round (window_width * ICON_SCALE); icon_box_height = round (window_height * ICON_SCALE); bright_box_width = round (icon_box_width); bright_box_height = round (window_height * 0.05); icon_box_x0 = round ((window_width - icon_box_width) / 2); icon_box_y0 = round ((window_height - icon_box_height - bright_box_height) / 2 - bright_box_height); bright_box_x0 = round (icon_box_x0); bright_box_y0 = round (icon_box_height + icon_box_y0) + bright_box_height; #if 0 g_message ("icon box: w=%f h=%f _x0=%f _y0=%f", icon_box_width, icon_box_height, icon_box_x0, icon_box_y0); g_message ("brightness box: w=%f h=%f _x0=%f _y0=%f", bright_box_width, bright_box_height, bright_box_x0, bright_box_y0); #endif res = render_custom (window, cr, icon_box_x0, icon_box_y0, icon_box_width, icon_box_height); if (! res && g_str_has_prefix (window->priv->icon_name, "media-eject")) { /* draw eject symbol */ draw_eject (cr, icon_box_x0, icon_box_y0, icon_box_width, icon_box_height); } if (window->priv->show_level != FALSE) { /* draw volume meter */ draw_volume_boxes (window, cr, (double)window->priv->volume_level / 100.0, bright_box_x0, bright_box_y0, bright_box_width, bright_box_height); } }
static void draw_action_volume (GsdMediaKeysWindow *window, cairo_t *cr) { int window_width; int window_height; double icon_box_width; double icon_box_height; double icon_box_x0; double icon_box_y0; double volume_box_x0; double volume_box_y0; double volume_box_width; double volume_box_height; gboolean res; gtk_window_get_size (GTK_WINDOW (window), &window_width, &window_height); icon_box_width = window_width * 0.65; icon_box_height = window_height * 0.65; volume_box_width = icon_box_width; volume_box_height = window_height * 0.05; icon_box_x0 = (window_width - icon_box_width) / 2; icon_box_y0 = (window_height - icon_box_height - volume_box_height) / 2; volume_box_x0 = icon_box_x0; volume_box_y0 = icon_box_height + icon_box_y0; #if 0 g_message ("icon box: w=%f h=%f x0=%f y0=%f", icon_box_width, icon_box_height, icon_box_x0, icon_box_y0); g_message ("volume box: w=%f h=%f x0=%f y0=%f", volume_box_width, volume_box_height, volume_box_x0, volume_box_y0); #endif res = render_speaker (window, cr, icon_box_x0, icon_box_y0, icon_box_width, icon_box_height); if (! res) { double speaker_width; double speaker_height; double speaker_cx; double speaker_cy; double wave_x0; double wave_y0; double wave_radius; speaker_width = icon_box_width * 0.5; speaker_height = icon_box_height * 0.75; speaker_cx = icon_box_x0 + speaker_width / 2; speaker_cy = icon_box_y0 + speaker_height / 2; wave_x0 = window_width / 2; wave_y0 = speaker_cy; wave_radius = icon_box_width / 2; #if 0 g_message ("speaker box: w=%f h=%f cx=%f cy=%f", speaker_width, speaker_height, speaker_cx, speaker_cy); #endif /* draw speaker symbol */ draw_speaker (cr, speaker_cx, speaker_cy, speaker_width, speaker_height); /* draw sound waves */ if (! window->priv->volume_muted) { draw_waves (cr, wave_x0, wave_y0, wave_radius); } } /* draw volume meter */ draw_volume_boxes (window, cr, (double)window->priv->volume_level / 100.0, volume_box_x0, volume_box_y0, volume_box_width, volume_box_height); }