add drawcircle() function and use it for floating/max windows instead of drawrectangle
This commit is contained in:
parent
9ad6b157df
commit
a06674fbe7
25
draw.c
25
draw.c
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <cairo.h>
|
||||
#include <cairo-xlib.h>
|
||||
#include <math.h>
|
||||
#include "layout.h"
|
||||
#include "util.h"
|
||||
#include "draw.h"
|
||||
|
@ -87,12 +88,36 @@ drawrectangle(Display *disp, int screen, int x, int y, int w, int h, Drawable dr
|
|||
}
|
||||
else
|
||||
cairo_rectangle(cr, x + 1, y, w, h);
|
||||
|
||||
cairo_stroke(cr);
|
||||
|
||||
cairo_destroy(cr);
|
||||
cairo_surface_destroy(surface);
|
||||
}
|
||||
|
||||
void
|
||||
drawcircle(Display *disp, int screen, int x, int y, int r, Drawable drawable, int dw, int dh, Bool filled, XColor color)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
|
||||
surface = cairo_xlib_surface_create(disp, drawable, DefaultVisual(disp, screen), dw, dh);
|
||||
cr = cairo_create (surface);
|
||||
cairo_set_line_width(cr, 1.0);
|
||||
cairo_set_source_rgb(cr, color.red / 65535.0, color.green / 65535.0, color.blue / 65535.0);
|
||||
if(filled)
|
||||
{
|
||||
cairo_arc (cr, x + r, y + r, r, 0, 2 * M_PI);
|
||||
cairo_fill(cr);
|
||||
}
|
||||
else
|
||||
cairo_arc (cr, x + r + 1, y + r, r, 0, 2 * M_PI);
|
||||
|
||||
cairo_stroke(cr);
|
||||
|
||||
cairo_destroy(cr);
|
||||
cairo_surface_destroy(surface);
|
||||
}
|
||||
|
||||
unsigned short
|
||||
textwidth(Display *disp, XftFont *font, char *text, ssize_t len)
|
||||
|
|
1
draw.h
1
draw.h
|
@ -26,5 +26,6 @@
|
|||
|
||||
void drawtext(Display *, int, int, int, int, int, Drawable, int, int, XftFont *, const char *, XColor []);
|
||||
void drawrectangle(Display *, int, int, int, int, int, Drawable, int, int, Bool, XColor);
|
||||
void drawcircle(Display *, int, int, int, int, Drawable, int, int, Bool, XColor);
|
||||
inline unsigned short textwidth(Display *, XftFont *, char *, ssize_t);
|
||||
#endif
|
||||
|
|
17
statusbar.c
17
statusbar.c
|
@ -140,15 +140,14 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
|
|||
awesomeconf->font,
|
||||
sel->name, awesomeconf->colors_selected);
|
||||
if(sel->isfloating)
|
||||
drawrectangle(disp, awesomeconf->phys_screen,
|
||||
x, y,
|
||||
(awesomeconf->font->height + 2) / 4,
|
||||
(awesomeconf->font->height + 2) / 4,
|
||||
awesomeconf->statusbar.drawable,
|
||||
awesomeconf->statusbar.width,
|
||||
awesomeconf->statusbar.height,
|
||||
sel->ismax,
|
||||
awesomeconf->colors_selected[ColFG]);
|
||||
drawcircle(disp, awesomeconf->phys_screen,
|
||||
x, y,
|
||||
(awesomeconf->font->height + 2) / 4,
|
||||
awesomeconf->statusbar.drawable,
|
||||
awesomeconf->statusbar.width,
|
||||
awesomeconf->statusbar.height,
|
||||
sel->ismax,
|
||||
awesomeconf->colors_selected[ColFG]);
|
||||
}
|
||||
else if(IS_ARRANGE(0, layout_tile) || IS_ARRANGE(0, layout_tileleft))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue