[statusbar] Fix left and right statusbars alpha support
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
0c8910d1df
commit
7cff3567e3
|
@ -892,18 +892,23 @@ draw_get_image_size(const char *filename)
|
||||||
}
|
}
|
||||||
#endif /* WITH_IMLIB2 */
|
#endif /* WITH_IMLIB2 */
|
||||||
|
|
||||||
/** Rotate a drawable
|
/** Rotate a drawable.
|
||||||
* \param ctx Draw context to draw to
|
* \param ctx Draw context to draw with.
|
||||||
* \param dest Drawable to draw the result
|
* \param src Drawable to draw from.
|
||||||
* \param dest_w Drawable width
|
* \param dest Drawable to draw to.
|
||||||
* \param dest_h Drawable height
|
* \param src_w Drawable width.
|
||||||
* \param angle angle to rotate
|
* \param src_h Drawable height.
|
||||||
* \param tx translate to this x coordinate
|
* \param dest_w Drawable width.
|
||||||
* \param ty translate to this y coordinate
|
* \param dest_h Drawable height.
|
||||||
* \return new rotated drawable
|
* \param angle angle to rotate.
|
||||||
|
* \param tx Translate to this x coordinate.
|
||||||
|
* \param ty Translate to this y coordinate.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
draw_rotate(draw_context_t *ctx, xcb_drawable_t dest, int dest_w, int dest_h,
|
draw_rotate(draw_context_t *ctx,
|
||||||
|
xcb_drawable_t src, xcb_drawable_t dest,
|
||||||
|
int src_w, int src_h,
|
||||||
|
int dest_w, int dest_h,
|
||||||
double angle, int tx, int ty)
|
double angle, int tx, int ty)
|
||||||
{
|
{
|
||||||
cairo_surface_t *surface, *source;
|
cairo_surface_t *surface, *source;
|
||||||
|
@ -911,8 +916,8 @@ draw_rotate(draw_context_t *ctx, xcb_drawable_t dest, int dest_w, int dest_h,
|
||||||
|
|
||||||
surface = cairo_xcb_surface_create(ctx->connection, dest,
|
surface = cairo_xcb_surface_create(ctx->connection, dest,
|
||||||
ctx->visual, dest_w, dest_h);
|
ctx->visual, dest_w, dest_h);
|
||||||
source = cairo_xcb_surface_create(ctx->connection, ctx->drawable,
|
source = cairo_xcb_surface_create(ctx->connection, src,
|
||||||
ctx->visual, ctx->width, ctx->height);
|
ctx->visual, src_w, src_h);
|
||||||
cr = cairo_create (surface);
|
cr = cairo_create (surface);
|
||||||
|
|
||||||
cairo_translate(cr, tx, ty);
|
cairo_translate(cr, tx, ty);
|
||||||
|
@ -1049,7 +1054,6 @@ xcolor_new(xcb_connection_t *conn, int phys_screen, const char *colstr, xcolor_t
|
||||||
colnum = strtoul(buf, NULL, 16);
|
colnum = strtoul(buf, NULL, 16);
|
||||||
p_delete(&buf);
|
p_delete(&buf);
|
||||||
color->alpha = RGB_COLOR_8_TO_16(strtoul(&colstr[7], NULL, 16));
|
color->alpha = RGB_COLOR_8_TO_16(strtoul(&colstr[7], NULL, 16));
|
||||||
printf("%d alpha\n", color->alpha);
|
|
||||||
if(errno != 0)
|
if(errno != 0)
|
||||||
{
|
{
|
||||||
warn("awesome: error, invalid color '%s'", colstr);
|
warn("awesome: error, invalid color '%s'", colstr);
|
||||||
|
|
|
@ -141,7 +141,7 @@ void draw_circle(draw_context_t *, int, int, int, bool, xcolor_t);
|
||||||
void draw_image(draw_context_t *, int, int, int, const char *);
|
void draw_image(draw_context_t *, int, int, int, const char *);
|
||||||
void draw_image_from_argb_data(draw_context_t *, int, int, int, int, int, unsigned char *);
|
void draw_image_from_argb_data(draw_context_t *, int, int, int, int, int, unsigned char *);
|
||||||
area_t draw_get_image_size(const char *filename);
|
area_t draw_get_image_size(const char *filename);
|
||||||
void draw_rotate(draw_context_t *, xcb_drawable_t, int, int, double, int, int);
|
void draw_rotate(draw_context_t *, xcb_drawable_t, xcb_drawable_t, int, int, int, int, double, int, int);
|
||||||
area_t draw_text_extents(xcb_connection_t *, int, font_t *, const char *);
|
area_t draw_text_extents(xcb_connection_t *, int, font_t *, const char *);
|
||||||
alignment_t draw_align_get_from_str(const char *);
|
alignment_t draw_align_get_from_str(const char *);
|
||||||
bool xcolor_new(xcb_connection_t *, int, const char *, xcolor_t *);
|
bool xcolor_new(xcb_connection_t *, int, const char *, xcolor_t *);
|
||||||
|
|
45
statusbar.c
45
statusbar.c
|
@ -49,7 +49,7 @@ statusbar_draw(statusbar_t *statusbar)
|
||||||
char *data;
|
char *data;
|
||||||
xcb_get_property_reply_t *prop_r;
|
xcb_get_property_reply_t *prop_r;
|
||||||
xcb_get_property_cookie_t prop_c;
|
xcb_get_property_cookie_t prop_c;
|
||||||
area_t rectangle = { 0, 0, 0, 0, NULL, NULL };
|
area_t rectangle = { 0, 0, 0, 0, NULL, NULL }, rootsize;;
|
||||||
xcb_atom_t rootpix_atom, pixmap_atom;
|
xcb_atom_t rootpix_atom, pixmap_atom;
|
||||||
xutil_intern_atom_request_t rootpix_atom_req, pixmap_atom_req;
|
xutil_intern_atom_request_t rootpix_atom_req, pixmap_atom_req;
|
||||||
|
|
||||||
|
@ -80,12 +80,37 @@ statusbar_draw(statusbar_t *statusbar)
|
||||||
if((data = xcb_get_property_value(prop_r)))
|
if((data = xcb_get_property_value(prop_r)))
|
||||||
{
|
{
|
||||||
rootpix = *(xcb_pixmap_t *) data;
|
rootpix = *(xcb_pixmap_t *) data;
|
||||||
xcb_copy_area(globalconf.connection, rootpix,
|
switch(statusbar->position)
|
||||||
statusbar->sw->drawable, statusbar->sw->gc,
|
{
|
||||||
statusbar->sw->geometry.x, statusbar->sw->geometry.y,
|
case Left:
|
||||||
0, 0,
|
rootsize = get_display_area(statusbar->phys_screen, NULL, NULL);
|
||||||
statusbar->sw->geometry.width,
|
draw_rotate(statusbar->ctx,
|
||||||
statusbar->sw->geometry.height);
|
rootpix, statusbar->ctx->drawable,
|
||||||
|
rootsize.width, rootsize.height,
|
||||||
|
statusbar->width, statusbar->height,
|
||||||
|
M_PI_2,
|
||||||
|
statusbar->sw->geometry.y + statusbar->width,
|
||||||
|
- statusbar->sw->geometry.x);
|
||||||
|
break;
|
||||||
|
case Right:
|
||||||
|
rootsize = get_display_area(statusbar->phys_screen, NULL, NULL);
|
||||||
|
draw_rotate(statusbar->ctx,
|
||||||
|
rootpix, statusbar->ctx->drawable,
|
||||||
|
rootsize.width, rootsize.height,
|
||||||
|
statusbar->width, statusbar->height,
|
||||||
|
- M_PI_2,
|
||||||
|
- statusbar->sw->geometry.y,
|
||||||
|
statusbar->sw->geometry.x + statusbar->height);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
xcb_copy_area(globalconf.connection, rootpix,
|
||||||
|
statusbar->sw->drawable, statusbar->sw->gc,
|
||||||
|
statusbar->sw->geometry.x, statusbar->sw->geometry.y,
|
||||||
|
0, 0,
|
||||||
|
statusbar->sw->geometry.width,
|
||||||
|
statusbar->sw->geometry.height);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
p_delete(&prop_r);
|
p_delete(&prop_r);
|
||||||
}
|
}
|
||||||
|
@ -110,12 +135,14 @@ statusbar_draw(statusbar_t *statusbar)
|
||||||
switch(statusbar->position)
|
switch(statusbar->position)
|
||||||
{
|
{
|
||||||
case Right:
|
case Right:
|
||||||
draw_rotate(statusbar->ctx, statusbar->sw->drawable,
|
draw_rotate(statusbar->ctx, statusbar->ctx->drawable, statusbar->sw->drawable,
|
||||||
|
statusbar->ctx->width, statusbar->ctx->height,
|
||||||
statusbar->ctx->height, statusbar->ctx->width,
|
statusbar->ctx->height, statusbar->ctx->width,
|
||||||
M_PI_2, statusbar->height, 0);
|
M_PI_2, statusbar->height, 0);
|
||||||
break;
|
break;
|
||||||
case Left:
|
case Left:
|
||||||
draw_rotate(statusbar->ctx, statusbar->sw->drawable,
|
draw_rotate(statusbar->ctx, statusbar->ctx->drawable, statusbar->sw->drawable,
|
||||||
|
statusbar->ctx->width, statusbar->ctx->height,
|
||||||
statusbar->ctx->height, statusbar->ctx->width,
|
statusbar->ctx->height, statusbar->ctx->width,
|
||||||
- M_PI_2, 0, statusbar->width);
|
- M_PI_2, 0, statusbar->width);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -108,12 +108,16 @@ titlebar_draw(client_t *c)
|
||||||
switch(c->titlebar.position)
|
switch(c->titlebar.position)
|
||||||
{
|
{
|
||||||
case Left:
|
case Left:
|
||||||
draw_rotate(ctx, c->titlebar_sw->drawable, ctx->height, ctx->width,
|
draw_rotate(ctx, ctx->drawable, c->titlebar_sw->drawable,
|
||||||
|
ctx->width, ctx->height,
|
||||||
|
ctx->height, ctx->width,
|
||||||
- M_PI_2, 0, c->titlebar_sw->geometry.height);
|
- M_PI_2, 0, c->titlebar_sw->geometry.height);
|
||||||
xcb_free_pixmap(globalconf.connection, dw);
|
xcb_free_pixmap(globalconf.connection, dw);
|
||||||
break;
|
break;
|
||||||
case Right:
|
case Right:
|
||||||
draw_rotate(ctx, c->titlebar_sw->drawable, ctx->height, ctx->width,
|
draw_rotate(ctx, ctx->drawable, c->titlebar_sw->drawable,
|
||||||
|
ctx->width, ctx->height,
|
||||||
|
ctx->height, ctx->width,
|
||||||
M_PI_2, c->titlebar_sw->geometry.width, 0);
|
M_PI_2, c->titlebar_sw->geometry.width, 0);
|
||||||
xcb_free_pixmap(globalconf.connection, dw);
|
xcb_free_pixmap(globalconf.connection, dw);
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue