diff --git a/clients/cairo-util.c b/clients/cairo-util.c index 5aa9857a..7bcfe414 100644 --- a/clients/cairo-util.c +++ b/clients/cairo-util.c @@ -262,3 +262,17 @@ tile_source(cairo_t *cr, cairo_surface_t *surface, margin, height - margin - top_margin); cairo_fill(cr); } + +void +rounded_rect(cairo_t *cr, int x0, int y0, int x1, int y1, int radius) +{ + cairo_move_to(cr, x0, y0 + radius); + cairo_arc(cr, x0 + radius, y0 + radius, radius, M_PI, 3 * M_PI / 2); + cairo_line_to(cr, x1 - radius, y0); + cairo_arc(cr, x1 - radius, y0 + radius, radius, 3 * M_PI / 2, 2 * M_PI); + cairo_line_to(cr, x1, y1 - radius); + cairo_arc(cr, x1 - radius, y1 - radius, radius, 0, M_PI / 2); + cairo_line_to(cr, x0 + radius, y1); + cairo_arc(cr, x0 + radius, y1 - radius, radius, M_PI / 2, M_PI); + cairo_close_path(cr); +} diff --git a/clients/cairo-util.h b/clients/cairo-util.h index f28ac5f1..257489a2 100644 --- a/clients/cairo-util.h +++ b/clients/cairo-util.h @@ -34,4 +34,7 @@ void tile_source(cairo_t *cr, cairo_surface_t *surface, int x, int y, int width, int height, int margin, int top_margin); +void +rounded_rect(cairo_t *cr, int x0, int y0, int x1, int y1, int radius); + #endif diff --git a/clients/window.c b/clients/window.c index 4b712f81..48b444aa 100644 --- a/clients/window.c +++ b/clients/window.c @@ -172,20 +172,6 @@ static const GOptionEntry xkb_option_entries[] = { { NULL } }; -static void -rounded_rect(cairo_t *cr, int x0, int y0, int x1, int y1, int radius) -{ - cairo_move_to(cr, x0, y0 + radius); - cairo_arc(cr, x0 + radius, y0 + radius, radius, M_PI, 3 * M_PI / 2); - cairo_line_to(cr, x1 - radius, y0); - cairo_arc(cr, x1 - radius, y0 + radius, radius, 3 * M_PI / 2, 2 * M_PI); - cairo_line_to(cr, x1, y1 - radius); - cairo_arc(cr, x1 - radius, y1 - radius, radius, 0, M_PI / 2); - cairo_line_to(cr, x0 + radius, y1); - cairo_arc(cr, x0 + radius, y1 - radius, radius, M_PI / 2, M_PI); - cairo_close_path(cr); -} - static const cairo_user_data_key_t surface_data_key; struct surface_data { struct wl_buffer *buffer;