From 543899da7cae0d5b6c2c42652265947a27f0efa2 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sun, 11 Nov 2007 19:49:42 +0100 Subject: [PATCH] fix statusbar display when on right --- draw.c | 9 +++++---- draw.h | 2 +- statusbar.c | 15 +++++++++++---- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/draw.c b/draw.c index a5480d80..7b8397d4 100644 --- a/draw.c +++ b/draw.c @@ -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); diff --git a/draw.h b/draw.h index 52487f4b..252b7c7d 100644 --- a/draw.h +++ b/draw.h @@ -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 diff --git a/statusbar.c b/statusbar.c index 76003971..03b7c7b7 100644 --- a/statusbar.c +++ b/statusbar.c @@ -161,9 +161,16 @@ drawstatusbar(awesome_config *awesomeconf) if(awesomeconf->statusbar.position == BarRight || awesomeconf->statusbar.position == BarLeft) { - draw_rotate(awesomeconf->display, awesomeconf->phys_screen, - awesomeconf->statusbar.drawable, awesomeconf->statusbar.width, - awesomeconf->statusbar.height, M_PI * 1.5); + if(awesomeconf->statusbar.position == BarRight) + draw_rotate(awesomeconf->display, awesomeconf->phys_screen, + awesomeconf->statusbar.drawable, awesomeconf->statusbar.width, + 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);