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.h>
|
||||||
#include <cairo-xlib.h>
|
#include <cairo-xlib.h>
|
||||||
|
#include <math.h>
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
|
@ -87,12 +88,36 @@ drawrectangle(Display *disp, int screen, int x, int y, int w, int h, Drawable dr
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cairo_rectangle(cr, x + 1, y, w, h);
|
cairo_rectangle(cr, x + 1, y, w, h);
|
||||||
|
|
||||||
cairo_stroke(cr);
|
cairo_stroke(cr);
|
||||||
|
|
||||||
cairo_destroy(cr);
|
cairo_destroy(cr);
|
||||||
cairo_surface_destroy(surface);
|
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
|
unsigned short
|
||||||
textwidth(Display *disp, XftFont *font, char *text, ssize_t len)
|
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 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 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);
|
inline unsigned short textwidth(Display *, XftFont *, char *, ssize_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -140,10 +140,9 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
|
||||||
awesomeconf->font,
|
awesomeconf->font,
|
||||||
sel->name, awesomeconf->colors_selected);
|
sel->name, awesomeconf->colors_selected);
|
||||||
if(sel->isfloating)
|
if(sel->isfloating)
|
||||||
drawrectangle(disp, awesomeconf->phys_screen,
|
drawcircle(disp, awesomeconf->phys_screen,
|
||||||
x, y,
|
x, y,
|
||||||
(awesomeconf->font->height + 2) / 4,
|
(awesomeconf->font->height + 2) / 4,
|
||||||
(awesomeconf->font->height + 2) / 4,
|
|
||||||
awesomeconf->statusbar.drawable,
|
awesomeconf->statusbar.drawable,
|
||||||
awesomeconf->statusbar.width,
|
awesomeconf->statusbar.width,
|
||||||
awesomeconf->statusbar.height,
|
awesomeconf->statusbar.height,
|
||||||
|
|
Loading…
Reference in New Issue