static void draw_action_eject (GsdMediaKeysWindow *window, cairo_t *cr) { int window_width; int window_height; double width; double height; double x0; double y0; gboolean res; gtk_window_get_size (GTK_WINDOW (window), &window_width, &window_height); width = window_width * 0.65; height = window_height * 0.65; x0 = (window_width - width) / 2; y0 = (window_height - height) / 2; #if 0 g_message ("eject box: w=%f h=%f x0=%f y0=%f", width, height, x0, y0); #endif res = render_eject (window, cr, x0, y0, width, height); if (! res) { /* draw eject symbol */ draw_eject (cr, x0, y0, width, 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); } }