fix statusbar display when on right

This commit is contained in:
Julien Danjou 2007-11-11 19:49:42 +01:00
parent 05dad60786
commit 543899da7c
3 changed files with 17 additions and 9 deletions

9
draw.c
View File

@ -126,7 +126,7 @@ drawcircle(Display *disp, int screen, int x, int y, int r, Drawable drawable, in
}
void
draw_rotate(Display *disp, int screen, Drawable drawable, int dw, int dh, double angle)
draw_rotate(Display *disp, int screen, Drawable drawable, int dw, int dh, double angle, int tx, int ty)
{
cairo_surface_t *surface, *source;
cairo_t *cr;
@ -134,11 +134,12 @@ draw_rotate(Display *disp, int screen, Drawable drawable, int dw, int dh, double
surface = cairo_xlib_surface_create(disp, drawable, DefaultVisual(disp, screen), dw, dw);
source = cairo_xlib_surface_create(disp, drawable, DefaultVisual(disp, screen), dw, dw);
cr = cairo_create (surface);
cairo_rotate(cr, M_PI / 2);
cairo_translate(cr, 0.0, -dh);
cairo_rotate(cr, angle);
cairo_translate(cr, tx, ty);
cairo_set_source_surface(cr, source, 0.0, 0.0);
cairo_paint_with_alpha(cr, 1.0);
cairo_paint(cr);
cairo_destroy(cr);
cairo_surface_destroy(source);

2
draw.h
View File

@ -27,7 +27,7 @@
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);
void draw_rotate(Display *, int, Drawable, int, int, double);
void draw_rotate(Display *, int, Drawable, int, int, double, int, int);
unsigned short textwidth(Display *, XftFont *, char *);
#endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99

View File

@ -161,9 +161,16 @@ drawstatusbar(awesome_config *awesomeconf)
if(awesomeconf->statusbar.position == BarRight
|| awesomeconf->statusbar.position == BarLeft)
{
if(awesomeconf->statusbar.position == BarRight)
draw_rotate(awesomeconf->display, awesomeconf->phys_screen,
awesomeconf->statusbar.drawable, awesomeconf->statusbar.width,
awesomeconf->statusbar.height, M_PI * 1.5);
awesomeconf->statusbar.height, M_PI * 0.5,
0, -awesomeconf->statusbar.height);
else
draw_rotate(awesomeconf->display, awesomeconf->phys_screen,
awesomeconf->statusbar.drawable, awesomeconf->statusbar.width,
awesomeconf->statusbar.height, M_PI * 0.5,
0, -awesomeconf->statusbar.height);
XCopyArea(awesomeconf->display, awesomeconf->statusbar.drawable,
awesomeconf->statusbar.window,
DefaultGC(awesomeconf->display, awesomeconf->phys_screen), 0, 0,
@ -250,7 +257,7 @@ updatebarpos(Display *disp, Statusbar statusbar)
XMoveWindow(disp, statusbar.window, si[statusbar.screen].x_org, si[statusbar.screen].y_org);
break;
case BarRight:
XMoveWindow(disp, statusbar.window, si[statusbar.screen].width - statusbar.width, si[statusbar.screen].y_org);
XMoveWindow(disp, statusbar.window, si[statusbar.screen].width - statusbar.height, si[statusbar.screen].y_org);
break;
case BarBot:
XMoveWindow(disp, statusbar.window, si[statusbar.screen].x_org, si[statusbar.screen].height - statusbar.height);